0
votes

I have a one method in my view and i want to call this method from controller.The controller and view is like this :

App.theController = Ember.ArrayController.extend({
methodA:function(){
    //how to call methodB in view 
}
});
App.theView = Ember.View.extend({
methodB:function(){
    //do something
}
});

the question is how methodA can call methodB ?

1
This is not intended by Ember. You have to explain your usecase. There is a better way for sure. - mavilein

1 Answers

1
votes

This method should probably be on the controller.

    App.TheController = Ember.ArrayController.extend({
        methodA:function(){
            //do something 
        }
    });

    App.TheView = Ember.View.extend({
        methodB:function(){
            this.get("controller").methodA();
        }
    });

You can reference both of them through the container's lookup method, but this is not a recommended practice.