I was wondering what the best way to pass an array of model objects into a new array defined in a view is in ember?
Basically: There is a bunch of people via an association in the controller:
App.MeetingsNewController = Ember.ObjectController.extend({
needs: ['people'],
init: function() {
var people = this.get('controllers.people');
people.set('content', App.Person.find());
}
});
Then inside the template for that controller I am defining a view. Inside this view I want to get all of the people set on the controller and put them in an array. When one is selected I want to move it to a new array. Simple enough, but I cannot work out the process for doing this.
App.SearchField = Ember.View.extend({
availablePeople: [],
selectedPeople: [],
init: function() {
// What needs to go here to push objects from controller.people to availablePeople?
}
});
I have tried various things using this.get('controller.people') and pushObjects, but I never seem to be able to iterate over the list in the template of the view:
{{#each view.availablePeople}}
<li>
{{ name }}
</li>
{{/each}}
What am I missing? Any help much appreciated!
data
in your views? is it transient data? - intuitivepixel