Reputation: 55
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.
Upvotes: 0
Views: 48
Reputation: 13558
Observable.timer(500).subscribe(() => {
this.success = true;
Observable.timer(5000).subscribe(() => this.success = false);
});
Upvotes: 1