jeudi 29 décembre 2016

Controller parent sharing content between its child

I have a base class which has some properties. I'm inheriting this class into two other controllers. Whenever I set a content to this variable, though, the content is shared between the two controllers. I don't this to happen, otherwise I'd have used Mixins. I want to set the content in one child to something and when I go to the other route, the content is still blank.

// base controller
export default Ember.Controller.extend({
    method: null,
    actions: {
        changeMethod() {
            this.set('method', 'content is shared');
        }
    }
}
// children.js
import BaseClass from './base-class';

export default BaseClass.extend({ //code here });

// child1.hbs
 - it shows the same as child2.hbs

// child2.hbs
 - it shows the same as child1.hbs




Aucun commentaire:

Enregistrer un commentaire