Since ngModel is updating instantly how to put a delay.
Here's a solution that works with a callback.
view template:
component class:
actionsByElements = new Map();
delayAction(element: HTMLElement, cb: Function, args: any[]) {
// cancel countdown by element
let action = this.actionsByElements.get(element);
if(action) {
action.unsubscribe();
}
// start new countdown by element
action = timer(1000).subscribe(() => cb.apply(this, args));
this.actionsByElements.set(element, action);
}
doSomething(){...}