Created
July 14, 2015 20:10
-
-
Save elwayman02/1ac2cabeb1dd722a2ffa to your computer and use it in GitHub Desktop.
Class definition separation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// foo-component.js | |
export default Ember.Component.extend({ | |
classNames: ['foo'], | |
barClasses: Ember.computed('bar', function () { | |
return this.get('bar') ? 'foo bar' : 'foo'; | |
}), | |
bazClasses: Ember.computed('baz', function () { | |
return this.get('baz') ? 'baz' : ''; | |
}) | |
}); | |
// foo.component.hbs | |
<div class='foo-header'> | |
<span class=barClasses>I am bar</span> | |
<div class='stuff things'>{{things-list things}}</div> | |
<div class=bazClasses> | |
{{#each bazItems as |item|}} | |
{{baz-component item}} | |
{{/each}} | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment