@@ -5,6 +5,7 @@ <h2>Options</h2>
5
5
< mat-checkbox [(ngModel)] ="yearView "> Start in year view</ mat-checkbox >
6
6
< mat-checkbox [(ngModel)] ="datepickerDisabled "> Disable datepicker</ mat-checkbox >
7
7
< mat-checkbox [(ngModel)] ="inputDisabled "> Disable input</ mat-checkbox >
8
+ < mat-checkbox [(ngModel)] ="showActions "> Show action buttons</ mat-checkbox >
8
9
< mat-form-field >
9
10
< mat-select [(ngModel)] ="color " placeholder ="Color ">
10
11
< mat-option value ="primary "> Primary</ mat-option >
@@ -19,14 +20,24 @@ <h2>Options</h2>
19
20
< input matInput [matDatepicker] ="minDatePicker " [(ngModel)] ="minDate "
20
21
[disabled] ="inputDisabled " [max] ="maxDate ">
21
22
< mat-datepicker-toggle matSuffix [for] ="minDatePicker "> </ mat-datepicker-toggle >
22
- < mat-datepicker #minDatePicker [touchUi] ="touch " [disabled] ="datepickerDisabled "> </ mat-datepicker >
23
+ < mat-datepicker #minDatePicker [touchUi] ="touch " [disabled] ="datepickerDisabled ">
24
+ < mat-datepicker-actions *ngIf ="showActions ">
25
+ < button mat-button matDatepickerCancel > Cancel</ button >
26
+ < button mat-raised-button color ="primary " matDatepickerApply > Apply</ button >
27
+ </ mat-datepicker-actions >
28
+ </ mat-datepicker >
23
29
</ mat-form-field >
24
30
< mat-form-field color ="accent ">
25
31
< mat-label > Max date</ mat-label >
26
32
< input matInput [matDatepicker] ="maxDatePicker " [(ngModel)] ="maxDate "
27
33
[disabled] ="inputDisabled " [min] ="minDate ">
28
34
< mat-datepicker-toggle matSuffix [for] ="maxDatePicker "> </ mat-datepicker-toggle >
29
- < mat-datepicker #maxDatePicker [touchUi] ="touch " [disabled] ="datepickerDisabled "> </ mat-datepicker >
35
+ < mat-datepicker #maxDatePicker [touchUi] ="touch " [disabled] ="datepickerDisabled ">
36
+ < mat-datepicker-actions *ngIf ="showActions ">
37
+ < button mat-button matDatepickerCancel > Cancel</ button >
38
+ < button mat-raised-button color ="primary " matDatepickerApply > Apply</ button >
39
+ </ mat-datepicker-actions >
40
+ </ mat-datepicker >
30
41
</ mat-form-field >
31
42
</ p >
32
43
< p >
@@ -35,7 +46,12 @@ <h2>Options</h2>
35
46
< input matInput [matDatepicker] ="startAtPicker " [(ngModel)] ="startAt "
36
47
[disabled] ="inputDisabled ">
37
48
< mat-datepicker-toggle matSuffix [for] ="startAtPicker "> </ mat-datepicker-toggle >
38
- < mat-datepicker #startAtPicker [touchUi] ="touch " [disabled] ="datepickerDisabled "> </ mat-datepicker >
49
+ < mat-datepicker #startAtPicker [touchUi] ="touch " [disabled] ="datepickerDisabled ">
50
+ < mat-datepicker-actions *ngIf ="showActions ">
51
+ < button mat-button matDatepickerCancel > Cancel</ button >
52
+ < button mat-raised-button color ="primary " matDatepickerApply > Apply</ button >
53
+ </ mat-datepicker-actions >
54
+ </ mat-datepicker >
39
55
</ mat-form-field >
40
56
</ p >
41
57
@@ -62,6 +78,10 @@ <h2>Result</h2>
62
78
[startAt] ="startAt "
63
79
[startView] ="yearView ? 'year' : 'month' "
64
80
[color] ="color ">
81
+ < mat-datepicker-actions *ngIf ="showActions ">
82
+ < button mat-button matDatepickerCancel > Cancel</ button >
83
+ < button mat-raised-button color ="primary " matDatepickerApply > Apply</ button >
84
+ </ mat-datepicker-actions >
65
85
</ mat-datepicker >
66
86
< mat-error *ngIf ="resultPickerModel.hasError('matDatepickerParse') ">
67
87
"{{resultPickerModel.getError('matDatepickerParse').text}}" is not a valid date!
@@ -90,6 +110,10 @@ <h2>Result</h2>
90
110
[disabled] ="datepickerDisabled "
91
111
[startAt] ="startAt "
92
112
[startView] ="yearView ? 'year' : 'month' ">
113
+ < mat-datepicker-actions *ngIf ="showActions ">
114
+ < button mat-button matDatepickerCancel > Cancel</ button >
115
+ < button mat-raised-button color ="primary " matDatepickerApply > Apply</ button >
116
+ </ mat-datepicker-actions >
93
117
</ mat-datepicker >
94
118
</ p >
95
119
@@ -191,7 +215,12 @@ <h2>Range picker</h2>
191
215
< mat-date-range-picker
192
216
[touchUi] ="touch "
193
217
[disabled] ="datepickerDisabled "
194
- #range1Picker > </ mat-date-range-picker >
218
+ #range1Picker >
219
+ < mat-date-range-picker-actions *ngIf ="showActions ">
220
+ < button mat-button matDateRangePickerCancel > Cancel</ button >
221
+ < button mat-raised-button color ="primary " matDateRangePickerApply > Apply</ button >
222
+ </ mat-date-range-picker-actions >
223
+ </ mat-date-range-picker >
195
224
</ mat-form-field >
196
225
< div > {{range1.value | json}}</ div >
197
226
</ div >
@@ -216,7 +245,12 @@ <h2>Range picker</h2>
216
245
[touchUi] ="touch "
217
246
[disabled] ="datepickerDisabled "
218
247
panelClass ="demo-custom-range "
219
- #range2Picker > </ mat-date-range-picker >
248
+ #range2Picker >
249
+ < mat-date-range-picker-actions *ngIf ="showActions ">
250
+ < button mat-button matDateRangePickerCancel > Cancel</ button >
251
+ < button mat-raised-button color ="primary " matDateRangePickerApply > Apply</ button >
252
+ </ mat-date-range-picker-actions >
253
+ </ mat-date-range-picker >
220
254
</ mat-form-field >
221
255
< div > {{range2.value | json}}</ div >
222
256
</ div >
@@ -240,7 +274,12 @@ <h2>Range picker</h2>
240
274
< mat-date-range-picker
241
275
[touchUi] ="touch "
242
276
[disabled] ="datepickerDisabled "
243
- #range3Picker > </ mat-date-range-picker >
277
+ #range3Picker >
278
+ < mat-date-range-picker-actions *ngIf ="showActions ">
279
+ < button mat-button matDateRangePickerCancel > Cancel</ button >
280
+ < button mat-raised-button color ="primary " matDateRangePickerApply > Apply</ button >
281
+ </ mat-date-range-picker-actions >
282
+ </ mat-date-range-picker >
244
283
</ mat-form-field >
245
284
< div > {{range3.value | json}}</ div >
246
285
</ div >
@@ -255,6 +294,11 @@ <h2>Range picker with custom selection strategy</h2>
255
294
< input matEndDate placeholder ="End date "/>
256
295
</ mat-date-range-input >
257
296
< mat-datepicker-toggle [for] ="range4Picker " matSuffix > </ mat-datepicker-toggle >
258
- < mat-date-range-picker customRangeStrategy #range4Picker > </ mat-date-range-picker >
297
+ < mat-date-range-picker customRangeStrategy #range4Picker >
298
+ < mat-date-range-picker-actions *ngIf ="showActions ">
299
+ < button mat-button matDateRangePickerCancel > Cancel</ button >
300
+ < button mat-raised-button color ="primary " matDateRangePickerApply > Apply</ button >
301
+ </ mat-date-range-picker-actions >
302
+ </ mat-date-range-picker >
259
303
</ mat-form-field >
260
304
</ div >
0 commit comments