Skip to content

Commit

Permalink
fix: Fixed pickatime bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rubyboy committed Aug 5, 2017
1 parent fd2b097 commit f4a7e35
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/materialize-directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ export class MaterializeDirective implements AfterViewInit,DoCheck,OnChanges,OnD
@Input()
public set materializeActions(actions: EventEmitter<string|MaterializeAction>) {
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);
})
}

Expand Down Expand Up @@ -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((<any>CustomEvent("input"))));
});
Expand Down

0 comments on commit f4a7e35

Please sign in to comment.