Magaesh
Magaesh

Reputation: 519

Adding a class dynamically to hide only yield part of the ember component without wrapping

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

Answers (1)

Raja.S.K
Raja.S.K

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

Related Questions