Last active
December 18, 2015 07:09
-
-
Save alexspeller/5744563 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// This is the presenter class that stores the state | |
App.FooPresenter = Em.ObjectProxy.create({ | |
textAreaContent: '', | |
isExpanded: false | |
}); | |
// This is your controller - be sure to set the content to a list of models in your route | |
App.FoosController = Em.ArrayController.extend({ | |
presenters: function() { | |
return this.get('content').map(function(foo){ | |
return App.FooPresenter.create({content: foo}); | |
}); | |
}.property('content.@each') | |
}); | |
// This is your template | |
{{#each presenters}} | |
name: {{name}} | |
{{#if isExpanded}} | |
<textarea> | |
{{textAreaContent}} | |
</textarea> | |
{{/if}} | |
{{/each}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment