Skip to content

Commit 5f4b0fc

Browse files
author
Tobias Schweizer
committed
refactor (MatCalendarHeader): make template file for custom header on demo page
1 parent 715e413 commit 5f4b0fc

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<div>
2+
<button (click)="previousClicked('year')">&lt;&lt;</button>
3+
<button (click)="previousClicked('month')">&lt;</button>
4+
{{periodLabel}}
5+
<button (click)="nextClicked('month')">&gt;</button>
6+
<button (click)="nextClicked('year')">&gt;&gt;</button>
7+
</div>

src/demo-app/datepicker/datepicker-demo.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,11 @@ export class DatepickerDemo {
4848

4949
// Custom header component for datepicker
5050
@Component({
51+
moduleId: module.id,
5152
selector: 'custom-header',
52-
template: `
53-
<div>
54-
<button (click)="previousClicked('year')">&lt;&lt;</button>
55-
<button (click)="previousClicked('month')">&lt;</button>
56-
{{periodLabel}}
57-
<button (click)="nextClicked('month')">&gt;</button>
58-
<button (click)="nextClicked('year')">&gt;&gt;</button>
59-
</div>
60-
`
53+
templateUrl: 'custom-header.html',
54+
styleUrls: [],
55+
changeDetection: ChangeDetectionStrategy.OnPush,
6156
})
6257
export class CustomHeader<D> {
6358
constructor(@Host() private _calendar: MatCalendar<D>,

0 commit comments

Comments
 (0)