Issue
I wonder how can i replace setTimeout() in Angular.
I have got something like this
public resetSelect: boolean = false;
private clearSelection(): void {
this.resetSelect = true;
this.myForm.get('time').setValue(null);
this.myForm.get('colors').setValue(null);
this.myForm.removeControl('drinks');
this.myForm.removeControl('food');
setTimeout(() => {
this.resetSelect = false;
}, 200);
}
resetSelect is set to true, to call a function by @Input() in other component.
Solution
you can use rxjs timer operator
import {timer} from 'rxjs'
timer(200).subscribe(_=>{
this.resetSelect = false;
})
But really I don’t know what do you want to achieve