Sunday 15 August 2010

ember.js - Idiomatic way to delete object from enclosing ArrayController -


I have an arreconductor which manages a group of objects; I define an item controller on it so that each Object object can be managed by the controller:

  app. : "SampleNameDeload"});   

Inside this object controller, I have a delete action that is using the "parent" array controller to remove objects from the attached axis:

  app Sample Model Controller = Ember.ObjectController.extend ({delete: function () {this.get ("target.content"). RemoveObject (this.get ("content"));}});   

I do not have to store global objects. I am currently using the target property to achieve such behavior, is this a candidate's approach to idiom?

The full example can be found

You take the deleted function in ArrayController Can go. This is understandable because the array controller is managing the collection. The way you do this works, but it does not seem right because your object is managing the array which is it, which is a strange way of writing it. = Ember.ArrayController.extend ({itemController: "sampleModel", delete: function (object) {this.get ('content'). RemoveObject (object)}}); App Sample Model Controller = Ember.ObjectController.extend ({});



No comments:

Post a Comment