Skip to content

Commit 7898779

Browse files
committed
fix #14 ngModelOptions for Angular 1.5-
1 parent 26b76bd commit 7898779

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

js/angular-material-datetimepicker.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,9 @@ function ngMaterialDatePicker(moment) {
159159
}
160160

161161
if (ngModel) {
162-
ngModel.$options = ngModel.$options.createChild({
163-
'*': '$inherit',
164-
debounce: 500
165-
});
162+
var ngModelOptions = {'*': '$inherit', debounce: 500};
163+
ngModel.$options = ngModel.$options ? ngModel.$options.createChild(ngModelOptions) : ngModelOptions;
164+
166165
ngModel.$formatters.push(function (value) {
167166
if (typeof value === 'undefined') return;
168167
var m = moment(value);

0 commit comments

Comments
 (0)