I want to show this element only for 5 seconds and after that needs to remove from the dom.
{{#if canShow}}
<div>
This is block
</div>
{{/if}}
Please help me to solve. I don’t know how to achieve this.
I want to show this element only for 5 seconds and after that needs to remove from the dom.
{{#if canShow}}
<div>
This is block
</div>
{{/if}}
Please help me to solve. I don’t know how to achieve this.
2
Answers
If you are in an Ember component you can use:
You could create a modifier that, when added to an element, will remove the element from the DOM after a certain period of time.
First install
ember-modifier
(this is installed by default in new Ember projects):ember install ember-modifier
Then create a new modifier
ember g modifier remove-after
.