Can you tell me why this gets me
Cannot call substring of undefined. Cannot call method getModel of undefined.
Ext.require(
['MyApp.controller.Country', 'MyApp.controller.CountryProperties'], // this auto-loads all dependencies
function(){
// ... as soon as this class
// and all its dependencies have loaded...
var controller = Ext.create('MyApp.controller.Country'); // create an instance
var controller2 = Ext.create('MyApp.controller.CountryPropeties'); // create an instance
controller.init(); // launch init() method
controller2.init();
}
);
But when I add those controllers, views, stores and models manually in app.js into controllers: [], views: [] etc. it works.
Btw. I have inside controller -> stores:[], views: [] so when I load only a controller, it should load any dependencies for controller.
Why I get that error?
Thank you. :)
Just in addition to @arshabh answer which is perfectly right.
If you call (rev 1. - fixed typo)
this.application.getController('Country');
this.application.getController('CountryPropeties');
from your controller you get exactly the same result as you do it, just a little simpler. Note that the application getter automatically load missing classes and for the controller or store initialize/register them.