Skip to content

Commit ff51199

Browse files
feat: on push strategy for date picker
1 parent e16af1d commit ff51199

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/datepicker-input/datepicker-input.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import {
55
EventEmitter,
66
ElementRef,
77
TemplateRef,
8-
ViewChild
8+
ViewChild,
9+
ChangeDetectionStrategy
910
} from "@angular/core";
1011
import { NG_VALUE_ACCESSOR } from "@angular/forms";
1112

@@ -124,7 +125,8 @@ import { NG_VALUE_ACCESSOR } from "@angular/forms";
124125
useExisting: DatePickerInput,
125126
multi: true
126127
}
127-
]
128+
],
129+
changeDetection: ChangeDetectionStrategy.OnPush
128130
})
129131
export class DatePickerInput {
130132
private static datePickerCount = 0;

src/datepicker/datepicker.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import {
1414
AfterViewInit,
1515
ViewChild,
1616
OnInit,
17-
SimpleChange
17+
SimpleChange,
18+
ChangeDetectionStrategy
1819
} from "@angular/core";
1920
import rangePlugin from "flatpickr/dist/plugins/rangePlugin";
2021
import flatpickr from "flatpickr";
@@ -120,7 +121,8 @@ if (languages.default?.default["en"]?.weekdays) {
120121
multi: true
121122
}
122123
],
123-
encapsulation: ViewEncapsulation.None
124+
encapsulation: ViewEncapsulation.None,
125+
changeDetection: ChangeDetectionStrategy.OnPush
124126
})
125127
export class DatePicker implements
126128
OnInit,

0 commit comments

Comments
 (0)