javascript - Navigate to other controller form app controller -
so have app controller in sapui5:
sap.ui.define([ "sap/ui/core/mvc/controller", ], function(controller) { "use strict"; return controller.extend("com.test.controller.app", { oninit: function() { if (checksomething)) { // here call first controller } else { // here call second controller }; } }, }); });
and have second controller want call if 1 if-statement fails
sap.ui.define([ "sap/ui/core/mvc/controller", "sap/m/messagebox" ], function(controller, messagebox) { "use strict"; return controller.extend("com.test.controller1", { oninit: function() { this.oressourcebundle = this.getownercomponent().getmodel("i18n").getresourcebundle(); } }); });
here second controller:
sap.ui.define([ "sap/ui/core/mvc/controller", "sap/m/messagebox" ], function(controller, messagebox) { "use strict"; return controller.extend("com.test.controller2", { oninit: function() { this.oressourcebundle = this.getownercomponent().getmodel("i18n").getresourcebundle(); } }); });
i have view both controller don't copy because empty far anyway there
app.view.xml
controller1.view.xml
controller2.view.xml
how tell appcontroller call different controllers ?
i have implemented routes in manifest.json file
you can call other controller methods below
sap.ui.controller("com.test.controller2").yourmethodname();
Comments
Post a Comment