Arnold Arnold - 1 month ago 8
TypeScript Question

How to put time outs in angular2

I want to show a success message on firing submit button but only after 10 some sort of time and for that i wrote the following lines.

let timeoutId = setTimeout(() => {
this.success = true;;
},500);


Simmilarly,i want to close the message after certain amout of time ,let 5 sec .Can anyone suggest me how to do that.Thanks.

Answer
Observable.timer(500).subscribe(() => this.success = true)