Arnold Arnold - 1 year ago 73
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;;

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 Source
Observable.timer(500).subscribe(() => this.success = true)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download