Skip to content

Instantly share code, notes, and snippets.

@danielevans
Created March 12, 2012 18:12
Show Gist options
  • Save danielevans/2023729 to your computer and use it in GitHub Desktop.
Save danielevans/2023729 to your computer and use it in GitHub Desktop.
Bindings Problem
//This responds to a click in the DOM
var newList = App.List.createRecord({});
if(newList.get("valid")) {
newList.store.commit();
} else {
// my most recent attempt to prevent the bindings
App.store.deleteRecord(newList);
App.store.removeFromModelArrays(newList);
App.listsController.get("collection").removeObject(newList);
App.listsController.set("collection", App.store.findAll(App.List))
}
<ul>
{{#each lists}}
{{view App.ShowListView listBinding="this"}}
{{/each}}
</ul>
App.ListListsView = Ember.View.extend({
templateName: 'ember/templates/lists/list',
listsBinding: "App.listsController.collection"
});
App.listsController = Ember.Object.create({
collection: App.store.findAll(App.List)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment