-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Did Step 5 of Navigation & Routing; Manual routing without changing t…
…he hash;
- Loading branch information
Showing
6 changed files
with
52 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
sap.ui.define([ | ||
"com/mrb/UI5-Navigation-and-Routing/controller/BaseController" | ||
], function(BaseController) { | ||
"use strict"; | ||
|
||
return BaseController.extend("com.mrb.UI5-Navigation-and-Routing.controller.Home", {}); | ||
}); | ||
|
||
"com/mrb/UI5-Navigation-and-Routing/controller/BaseController" | ||
], function (BaseController) { | ||
"use strict"; | ||
|
||
return BaseController.extend("com.mrb.UI5-Navigation-and-Routing.controller.Home", { | ||
onDisplayNotFound: function () { | ||
/* | ||
alternative ways of getting the `sap.m.routing.Targets` Object | ||
this.getOwnerComponent().getRouter().getTargets() or | ||
this.getOwnerComponent().getTargets(). | ||
*/ | ||
//display the "notFound" target without changing the hash | ||
this.getRouter().getTargets().display("notFound", { | ||
fromTarget: "home" | ||
}); | ||
|
||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,28 @@ | ||
sap.ui.define([ | ||
"com/mrb/UI5-Navigation-and-Routing/controller/BaseController" | ||
"com/mrb/UI5-Navigation-and-Routing/controller/BaseController" | ||
], function (BaseController) { | ||
"use strict"; | ||
return BaseController.extend("com.mrb.UI5-Navigation-and-Routing.controller.NotFound", { | ||
onInit: function () { | ||
} | ||
}); | ||
}); | ||
"use strict"; | ||
return BaseController.extend("com.mrb.UI5-Navigation-and-Routing.controller.NotFound", { | ||
onInit: function () { | ||
var oRouter, oTarget; | ||
oRouter = this.getRouter(); | ||
oTarget = oRouter.getTarget("notFound"); | ||
oTarget.attachDisplay(function (oEvent) { | ||
this._oData = oEvent.getParameter("data"); // store the data | ||
}, this); | ||
}, | ||
|
||
// override the parent's onNavBack (inherited from BaseController) | ||
onNavBack: function () { | ||
// in some cases we could display a certain target when the back button is pressed | ||
if (this._oData && this._oData.fromTarget) { | ||
this.getRouter().getTargets().display(this._oData.fromTarget); | ||
delete this._oData.fromTarget; | ||
return; | ||
} | ||
|
||
// call the parent's onNavBack | ||
BaseController.prototype.onNavBack.apply(this, arguments); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters