Old Guides - You are viewing the guides for
Ember
v1.13.0.
An HTML element's class
attribute can be bound like any other
attribute:
<div class=>
Warning!
</div>
If the component's priority
property is "p4"
, this template will emit the following HTML:
<div class="p4">
Warning!
</div>
Conditional Values
If you want a class value based on a conditional property, use the Handlebars if
helper:
<div class=>
Warning!
</div>
If isUrgent
is true, this emits the following HTML:
<div class="is-urgent">
Warning!
</div>
If isUrgent
is false, no class name is added:
<div>
Warning!
</div>
You can also specify a class name to add when the property is false
:
<div class=>
Warning!
</div>
In this case, if the isEnabled
property is true
, the enabled
class will be added. If the property is false
, the class disabled
will be added.