Kyle Fransham
Kyle Fransham

Reputation: 1879

EXTJS5 MVVM: Get global controller from view controller

From a global controller, I can easily get a reference to another global controller with

this.getController('TargetController');

However, within the context of a view controller, how can I get a reference to that same controller? i.e.:

Ext.define('myCoolApp.view.SomeNeatController', {
    extend: 'Ext.app.ViewController',
    alias: 'controller.someneat',

    // this is bound to a button click event, let's say.
    onClick: function(button) {

        // How to get a reference to a global controller here? 
        // this.getController('TargetController'); is not defined
        // on the view controller....

    }

});

Probably something simple I'm missing, but any help would be appreciated.

Upvotes: 3

Views: 5363

Answers (1)

Saki
Saki

Reputation: 5856

Calling getController on your namespace should work:

myCoolApp.app.getController('TargetController');`

Upvotes: 5

Related Questions