From f4a7e35ce007965a6e8724c191d149234b7b0b81 Mon Sep 17 00:00:00 2001 From: Ruby Boyarski Date: Sat, 5 Aug 2017 11:24:18 +0300 Subject: [PATCH] fix: Fixed pickatime bug #343 --- src/materialize-directive.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/materialize-directive.ts b/src/materialize-directive.ts index 1ad1ac9..4a731db 100644 --- a/src/materialize-directive.ts +++ b/src/materialize-directive.ts @@ -60,11 +60,13 @@ export class MaterializeDirective implements AfterViewInit,DoCheck,OnChanges,OnD @Input() public set materializeActions(actions: EventEmitter) { actions.subscribe((action: string|MaterializeAction) => { - if (typeof action === "string") { - this.performLocalElementUpdates(action); - } else { - this.performLocalElementUpdates(action.action, action.params); - } + window.setTimeout(()=> { + if (typeof action === "string") { + this.performLocalElementUpdates(action); + } else { + this.performLocalElementUpdates(action.action, action.params); + } + },1); }) } @@ -190,9 +192,9 @@ export class MaterializeDirective implements AfterViewInit,DoCheck,OnChanges,OnD const picker = timePicker.pickatime('picker'); setTimeout(() => { if (this.ngModel) { - picker.set('select', this.ngModel); + picker.val(this.ngModel); } else { - picker.set('select', jqueryPickerElement.val()); + picker.val(jqueryPickerElement.val()); } jqueryPickerElement.on('change', e => nativeElement.dispatchEvent((CustomEvent("input")))); });