У меня проблема с созданием роутера. Я буду получать ошибку Cannot read property 'initialize' of undefined
каждый раз.
Это мой код в моем Component.js:
sap.ui.define([ "sap/ui/core/UIComponent", "sap/ui/model/json/JSONModel",
"sap/ui/core/routing/History", "sap/m/routing/RouteMatchedHandler" ],
function(UIComponent, JSONModel, Router, RouteHandler) {
"use strict";
return UIComponent.extend("myApp.Component", {
metadata: {
routing:{
config: {
viewType:"XML",
viewPath:"myApp.view",
targetControl: "idRoot",
targetAggregation: "pages",
clearTarget: false
},
routes:[{
pattern: "",
name:"Master",
view:"Master"
}]
}
},
init: function(){
var router = this.getRouter(); //Doesn't work
router.initialize(); //ERROR HERE
},
если я попробую var router = sap.ui.core.routing.Router.getRouter();
, то же самое.
Может ли кто-нибудь помочь мне с этим?