first commit
This commit is contained in:
30
webapp/controller/BaseController.js
Normal file
30
webapp/controller/BaseController.js
Normal file
@ -0,0 +1,30 @@
|
||||
sap.ui.define(
|
||||
["sap/ui/core/mvc/Controller", "sap/ui/core/routing/History"],
|
||||
/**
|
||||
* @param {typeof sap.ui.core.mvc.Controller} Controller
|
||||
*/
|
||||
function (Controller, History) {
|
||||
"use strict";
|
||||
|
||||
return Controller.extend("mvcapp00124.controller.BaseController", {
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
onInit: function () { },
|
||||
getRouter: function() {
|
||||
return sap.ui.core.UIComponent.getRouterFor(this);
|
||||
},
|
||||
onNavBack: function(oEvent) {
|
||||
var oHistory, sPreviousHash;
|
||||
oHistory = History.getInstance();
|
||||
sPreviousHash = oHistory.getPreviousHash();
|
||||
|
||||
if(sPreviousHash !== undefined) {
|
||||
window.history.go(-1);
|
||||
}else {
|
||||
this.getRouter().navTo("home", {}, {}, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
Reference in New Issue
Block a user