Reputation: 519
Is there any way to add a class(In my case it is hide class) dynamically to hide(display : none) only yield part of the ember component without wrapping the yield part of the component with tags (div,span or anyother) in Ember JS?
My Case :
{{#if isLoading}}
<p>Loading....!</p>
{{/if}}
<div class="{{isLoading "hide"}}">
{{yield}}
</div>
Here I want to hide the yield part without wrapping it up by a div tag
Note : I can't use If Else statement as it will destroy the current instance of component every time isLoading property changes. This is a component to show loading. Any other ways to use a component for loading is appreciated
Upvotes: 2
Views: 330
Reputation: 208
You can't add a class without specifying an element or a tag. If you want to add class name to the yield part, then wrapping it in a container is the only way.
Upvotes: 2