Skip to content

Instantly share code, notes, and snippets.

@shenst1
Last active August 29, 2015 14:25
Show Gist options
  • Save shenst1/bd89f220f8b626928185 to your computer and use it in GitHub Desktop.
Save shenst1/bd89f220f8b626928185 to your computer and use it in GitHub Desktop.
//this controller is not being used because i am on the wrong route.
import Ember from 'ember';
export default Ember.Controller.extend({
isEditing: false,
actions: {
editRecord() {
this.set('isEditing', true);
}
}
});
{{#each model.records as |record|}}
<li {{ bind-attr class="isEditing:editing :collection-row"}}>
{{#if isEditing}}
<div class="form-group">
{{input type="text" class="form-control" value="record.title"}}
</div>
{{else}}
<span {{action "editRecord" record}} class="collection-row-title">{{record.title}}</span>
<div class="collection-row-right">
<span>Edit</span>
</div>
{{/if}}
</li>
{{/each}}
@pootsbook
Copy link

Looks like you might want an Item Controller although be aware that this will be phased out in Ember 2.0. Instead you could delegate to a component.

{{#each model.records as |record|}}
   {{record-display record=record}}
 {{/each}}

See this thread for discussion: Good way to do this in Ember 2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment