I am trying to build a simple Hello World App in OpenUI5 using the proper MVC structure. I am using sap.m.App and not SplitApp. So my App.view.js looks like this :
....
createContent : function(oController) {
this.setDisplayBlock(true);
this.app = new sap.m.App("targetAppId", {
});
return this.app;
}
....
In my component, for routing I am wrote the following code :
routing : {
config : {
viewType : "XML",
viewPath : "./view",
targetControl : "targetAppId",
clearTarget : false,
transition : "slide"
},
routes : [{
pattern : "",
viewType : "XML",
name : "splash",
view : "splash",
viewPath : "./view",
viewLevel : 0,
}
]
}
}
Both my App.view.js and splash.view.xml is in ./view .
In my component.js I wrote the following code to load the view :
createContent : function() {
var oView = sap.ui.view({
id : "app",
viewName : "./view.App",
type : "JS",
viewData : {
component : this
}
});
return oView;
}
splash.view.xml -
<mvc:View xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m" >
<Page
showHeader="true">
<content>
<Text text="Hello"/>
</content>
</Page>
</mvc:View>
On execution I get a blank blue color screen. For some reason it is not navigating to splash.view.xml. I have no idea why. Please help.
EDIT :
If I change the sap.m.App to sap.m.SplitApp and add targetAggregation : "masterPages". Everything works
UPDATE :
What I did is changing the targetAggregation : "pages" . And everything works fine. Writing this here, in case it helps somebody.