Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3167

getRouter

$
0
0

Hi,

 

has anyone an idea how I get the router from a .js File with no Controller?

 

I have a component.js where I initialize the Router with the manifest.json:

sap.ui.define([   "sap/ui/core/UIComponent"
], function (UIComponent) {   "use strict";   return UIComponent.extend("app.Component", {      metadata : {            manifest: "json"      },      init : function () {         UIComponent.prototype.init.apply(this, arguments);         this.getRouter().register("router");         this.getRouter().initialize();      }   });
});
  "routing": {    "config": {  "routerClass": "sap.m.routing.Router",  "viewType": "XML",  "viewPath": "app.view",  "controlId": "app",  "controlAggregation": "pages",  "targetControl": "navContainer",  "transition": "slide",  "clearTarget": "false",    },

And I have a app.controller where load and execute the test.js:

jQuery.sap.require("app/controller/tracking");
sap.ui.define([  "app/controller/BaseController"
], function (BaseController) {  "use strict";  return BaseController.extend("app.controller.App", {  onInit: function() {  }  });

 

Now I want to get the router in my test.js. It doesn't work with sap.ui.core.routing.Router.getRouter(routerId);

 

Thank you


Viewing all articles
Browse latest Browse all 3167

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>