I want to use component.js in js view but it is taking rootview for searching xml file. Please help how should I write this file so that I can do routing in js views.
jQuery.sap.declare("com.resident.Component");
sap.ui.core.UIComponent.extend("com.resident.Component", {
metadata : {
rootView : "com.resident.residentbhartiya.App",
routing : {
config : {
targetsClass : "sap.m.routing.Targets",
viewPath : "com.resident.residentbhartiya",
controlId : "rootControl",
controlAggregation : "pages",
viewType : "JS"
},
targets : {
page1 : {
viewName : "loginpage",
viewLevel : 0
},
page2 : {
viewName : "homepage",
viewLevel : 1
}
}
}
},
init : function() {
sap.ui.core.UIComponent.prototype.init.apply(this, arguments);
this.getTargets().display("page1");
},
});