Reputation: 5320
I have a text area that should receive focus when the model of its associated controller changes.
Prior to rc8, I used this observer:
modelChanged: function() {
this.set('focusing', true);
this.$().focus();
this.set('focusing', false);
}.observes('controller.model'),
I can't get it to work in 1.0.0 release or rc8. I have verified that an observer in the controller fires when expected:
modelChanged: function() {
console.log('TextArtController->modelChanged');
}.observes('model'),
However I would much refer not to have the controller at that level care about the specific view (I want pull not push)
After some more digging I discovered this change note:
This severs my textarea subclass from the controller/view hierarchy.
Upvotes: 1
Views: 521
Reputation: 23322
In the latest version of ember 1.0.0 the view's TextField
& TextArea
where converted to components Ember.Component
and since components as isolated view's not knowing about it's context the controller
property does not refer to the controller
anymore.
Said that, a way you could still accomplish what you are trying to do would be to use the not documented targetObject
which refers to the controller
in the view's surrounding context.
modelChanged: function() {
this.set('focusing', true);
this.$().focus();
this.set('focusing', false);
}.observes('targetObject.model'),
Hope it helps.
Upvotes: 3