lundi 28 novembre 2016

Ember - controller not overriding inherited property

I have 2 controllers, one extending the other. Have a prop "order" defined in one of them. And need to change value for that in the other controller which extends the first one. But its not doing so.

Controller A:

define('ControllerA', function(){
    var controller = Ember.Controller.extend({
      order:1
    })
    return controller;
})

Controller B:

define('ControllerB', ['ControllerA'] function(ControllerA){
    var controller = ControllerA.extend({
       order:2
    })
    return controller;
})

This is a very minified version of both controllers. These 2 have different routes which essentially show the same components but with different data, which changes based on order property.

When i go to the 2nd route, i.e B, the value of "order" is not being overridden, i.e. i want it to be 2, but it still picks it up as 1. Am i missing something.




Aucun commentaire:

Enregistrer un commentaire