Reputation: 930
I have my Route setup with models from FireBase:
App.ApplicationRoute = Ember.Route.extend({
model: function() {
return EmberFire.Array.create({
ref: new Firebase("https://some-database.firebaseio.com/shape")
});
},
setupController: function(controller, model) {
controller.set('model', model);
}
});
In the template I'm display each array object within a view with #each:
{#each controller}}
{{#view App.ColorView}}
<div>{{color}}</div>
{{/view}}
{{/each}}
And in the view I like a click action to delete the particular color:
App.ColorView = Ember.View.extend({
click: function() {
var theColor = this.get('content');
console.log(theColor);
}
});
Currently a list of colors show up int he view but I'm getting "undefined" when I try to access the model property belongs to this object. Are there additional setup that I need to do?
Upvotes: 0
Views: 256
Reputation: 19128
You can pass using contentBinding
{#each controller}}
{{#view App.ColorView contentBinding=this}}
<div>{{color}}</div>
{{/view}}
{{/each}}
Upvotes: 0