Skip to content

Commit

Permalink
fix: Fixed datepicker initial value bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rubyboy committed Aug 19, 2017
1 parent 8f79d05 commit 4545b9c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/materialize-directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ export class MaterializeDirective implements AfterViewInit,DoCheck,OnChanges,OnD
if (this.ngModel) { // PR 292 - 1
picker.set('select', this.ngModel);
} else {
picker.set('select', jqueryPickerElement.val());
const value = jqueryPickerElement.val();
if (value && value.length>0) {
picker.set('select', value);
}
}
jqueryPickerElement.on('change', e => nativeElement.dispatchEvent((<any>CustomEvent("input"))));
});
Expand Down

0 comments on commit 4545b9c

Please sign in to comment.