Hi,
i'm following an openSap tutorial and in the following code snippet i get the error: "AddFlexibilityRequest.controller.js:8 Uncaught (in promise) TypeError: this.getRouter is not a function".
sap.ui.define(["sap/ui/core/mvc/Controller" ], function(Controller) {
"use strict";
return Controller.extend("e4u.usr.a627603.FlexiForecast.WebContent.controller.AddFlexibilityRequest", {
onInit: function() {
this.getRouter().getRoute("addFlexibilityRequest").attachPatternMatched(this._onRouteMatched, this);
},
_onRouteMatched : function() {
var oModel = this.getModel(this);
oModel.metaDataLoaded().then(this._onMetaDataLoaded.bind(this));
},
[...]
})
I know i can handle this by typing:
sap.ui.core.UIComponent.getRouterFor(this);
But why does this error occur?
Thanks,
Tobias