Migrating from Ember 1.8 to 1.10 - observing a property on a controller in a view stopped working


#1

Hey,

I’m migrating from Ember CLI 1.x to 2.0 and thus migrating from Ember 1.8.1 to 1.10 as well. It looks like observers in one of my views stopped working. I’ve a got the following view (simplified):

import Ember from 'ember';

export default Ember.View.extend({
    didInsertElement: function () {
        this.set('path', this.$().find('path'));
    },
    sendingProgressDidChange: function () {
        var progress = this.get('controller.model.transfer.sendingProgress');
        this._calculateSVGAnim(progress);
    }.observes('controller.model.transfer.sendingProgress'),

    receivingProgressDidChange: function () {
        var progress = this.get('controller.model.transfer.receivingProgress');
        this._calculateSVGAnim(progress);
    }.observes('controller.model.transfer.receivingProgress')
});

After updating Ember to 1.10, both sendingProgressDidChange and receivingProgressDidChange observers stopped working. However, if I add this.get('controller') to didInsertElement function, they work again…

Any ideas what can be wrong?


#2

controller is a computed property perhaps there is some oddness in observing computed properties?

You may want to pass in the model explicitly to your view and change your view to a component in preparation for the deprecation of controller in 2.0.
eg

in the controller template

{{component model=model}}

#3

Thanks! I’ll try using component instead.