Is there a way to delegate object’s attributes directly into a controller?
I really don’t know how to explain this, so here is an example:
I have an object:
App.Person = Ember.Object.extend({
say: function(thing) {
alert(thing);
}
});
and a controller:
App.MyController = Ember.Controller.extend({
myPerson: null,
actions: {
createPerson: function(){
this.set('myPerson', App.Person.create({
name: "Tom Dale"
}));
}
}
});
Now, when I want to access a ‘name’ attribute, I have to do it like this: this.get(‘person.name’) or this.get(‘person’).name
Is there a way to proxy (delegate?) all the attributes of Person object directly into the controller, so that I could call this.get(‘name’)? I am looking for something like {{#with}} in templates…
btw. I really care just about object’s attributes, functions dos not have to be proxied
thanks a lot