Reputation: 44331
To access a model property in a template I was simply doing:
{{name}}
As explained in the guide
I have now moved to [email protected], with ember@canary (1.12.0-beta.1+canary.50206d0f), [email protected], [email protected], and somehow I find myself forced to prefix all properties with model.
. This happens for straight properties, like:
{{model.name}}
And bound properties, like:
{{view "verifiedEmail" emailBinding="model.email" verifiedBinding="model.isEmailVerified"}}
Is this expected? Where is this documented? This is really a pita, because that means lots of changes in my templates.
I recall reading somewhere that object proxying was getting deprecated, but I can not find the reference to it anymore.
Upvotes: 1
Views: 377
Reputation: 4434
The Routeable Components section of The Road to Ember 2.0 explains why these changes are necessary.
Note specifically the point:
In both cases, the short version is that you can no longer rely on the proxying behavior of ObjectController or ArrayController, but you can remedy the situation by prefixing model. to the property name.
Also note that if you have a large portion of your app that would require refactoring due to these changes, the Ember core team has stated:
We will also provide an optional plugin for Ember 2.0 apps that restores existing behavior.
So you may not need to refactor immediately, if it is too much of a hassle.
Upvotes: 1
Reputation: 8121
Apparently, this is part of the transition plan to Ember 2.0 (https://github.com/emberjs/rfcs/pull/15)
Instead of referring to model properties directly (or on this), you will refer to them as model.propName. Similarly, computed properties that move to your component will need to depend on model.propName if they are migrated from an ObjectController. In both cases, the short version is that you can no longer rely on the proxying behavior of ObjectController or ArrayController, but you can remedy the situation by prefixing model. to the property name.
Upvotes: 1