117
rated 0 times
[
119]
[
2]
/ answers: 1 / hits: 63084
/ 6 Years ago, wed, february 21, 2018, 12:00:00
I'm setting a timeout to hide an element after a while in Angular 5:
this.showElement = true;
setTimeout(function () {
console.log('hide');
this.showElement = false;
}, 2000);
However, this doesn't update the view. The console.log
gives me an output, so the timeout definitely works.
I have found that in Angularjs you needed to call $apply
in order to start a digest, so I'm guessing I just need to find the Angular 5 equivalent way of doing that.
More From » angular