The UI5 Documentation provides an example of how to deal with this problem by using a EventDelegatefunction onBeforeShowthat is automatically called by the framework. I adapted it to your use case:
app.to("detailPage", context);
myDetailPage.addEventDelegate({
onBeforeShow: function(evt) {
var context = evt.data.context;
}
});
You can decide whether to use addEventDelegateor (which I prefer) to write the function onBeforeShow in your target view . This could be your target view:
onBeforeShow(evt) {
var context = evt.data.context;
},
getControllerName : function() {
...
},
createContent : function() {
...
},
The object evt.datacontains all the data that you put in app.to(id, data). You can write it to the console to see the structure of the evt object.
Let me know if you have further questions.
source
share