Reputation: 101
I want to hide an element after some time ( about 2 seconds ).
in javascript in can use setTimeout
function for that. Is there a way that I could use it on Aurelia? or is there a better way for this?
Upvotes: 1
Views: 1637
Reputation: 1208
You can hide the element using the if
custom attribute included in Aurelia. Then bind that to a property on the viewmodel.
this.showItem = true;
window.setTimeout(() => this.showItem = false, 2000);
<h1 if.bind="showItem">I will hide in 2 seconds</h1>
Upvotes: 4