datepicker-demo.ts (material2-7.3.4) | : | datepicker-demo.ts (material2-7.3.5) | ||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright Google LLC All Rights Reserved. | * Copyright Google LLC All Rights Reserved. | |||
* | * | |||
* Use of this source code is governed by an MIT-style license that can be | * Use of this source code is governed by an MIT-style license that can be | |||
* found in the LICENSE file at https://angular.io/license | * found in the LICENSE file at https://angular.io/license | |||
*/ | */ | |||
import { | import { | |||
ChangeDetectionStrategy, | ChangeDetectionStrategy, | |||
ChangeDetectorRef, | ChangeDetectorRef, | |||
Component, | Component, | |||
Host, | ||||
Inject, | Inject, | |||
ViewChild, | ViewChild, | |||
Optional, | Optional, | |||
OnDestroy | OnDestroy | |||
} from '@angular/core'; | } from '@angular/core'; | |||
import {FormControl} from '@angular/forms'; | import {FormControl} from '@angular/forms'; | |||
import {MatCalendar, MatCalendarHeader} from '@angular/material'; | import {MatCalendar, MatCalendarHeader} from '@angular/material'; | |||
import {DateAdapter, MAT_DATE_FORMATS, MatDateFormats, ThemePalette} from '@angu lar/material/core'; | import {DateAdapter, MAT_DATE_FORMATS, MatDateFormats, ThemePalette} from '@angu lar/material/core'; | |||
import {MatDatepickerInputEvent} from '@angular/material/datepicker'; | import {MatDatepickerInputEvent} from '@angular/material/datepicker'; | |||
import {Subject} from 'rxjs'; | import {Subject} from 'rxjs'; | |||
skipping to change at line 71 | skipping to change at line 70 | |||
@Component({ | @Component({ | |||
moduleId: module.id, | moduleId: module.id, | |||
selector: 'custom-header', | selector: 'custom-header', | |||
templateUrl: 'custom-header.html', | templateUrl: 'custom-header.html', | |||
styleUrls: ['custom-header.css'], | styleUrls: ['custom-header.css'], | |||
changeDetection: ChangeDetectionStrategy.OnPush, | changeDetection: ChangeDetectionStrategy.OnPush, | |||
}) | }) | |||
export class CustomHeader<D> implements OnDestroy { | export class CustomHeader<D> implements OnDestroy { | |||
private _destroyed = new Subject<void>(); | private _destroyed = new Subject<void>(); | |||
constructor(@Host() private _calendar: MatCalendar<D>, | constructor( | |||
private _dateAdapter: DateAdapter<D>, | private _calendar: MatCalendar<D>, private _dateAdapter: DateAdapter<D>, | |||
@Inject(MAT_DATE_FORMATS) private _dateFormats: MatDateFormats, | @Inject(MAT_DATE_FORMATS) private _dateFormats: MatDateFormats, cdr: Chang | |||
cdr: ChangeDetectorRef) { | eDetectorRef) { | |||
_calendar.stateChanges | _calendar.stateChanges | |||
.pipe(takeUntil(this._destroyed)) | .pipe(takeUntil(this._destroyed)) | |||
.subscribe(() => cdr.markForCheck()); | .subscribe(() => cdr.markForCheck()); | |||
} | } | |||
ngOnDestroy() { | ngOnDestroy() { | |||
this._destroyed.next(); | this._destroyed.next(); | |||
this._destroyed.complete(); | this._destroyed.complete(); | |||
} | } | |||
End of changes. 2 change blocks. | ||||
5 lines changed or deleted | 4 lines changed or added |