I have 4 views and the main view is the login page. So when user click login button with correct credentials it will redirect to main page. But I received an error Can not navigate to route with name main because the route does not exist
Below is my manifest.json routing config:
"routing": {
"config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"async": true,
"viewPath": "UI.sap_portal.view",
"controlAggregation": "pages",
"controlId": "app",
"clearControlAggregation": false,
"transition": "slide"
},
"routes": [
{
"name": "Routemain",
"pattern": "Routemain",
"target": [
"Targetmain"
]
}
],
"targets": {
"Targetmain": {
"viewType": "XML",
"transition": "slide",
"clearControlAggregation": false,
"viewId": "login",
"viewName": "login",
"viewLevel": 1
},
"main": {
"viewId": "main",
"viewType": "XML",
"viewName": "main",
"viewLevel": 1
},
"masterData": {
"viewType": "XML",
"viewName": "masterData"
},
"purchasing": {
"viewType": "XML",
"viewName": "purchasing"
}
}
}
This is my login.controller.js code:
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
oRouter.navTo("main");
If I put this in my manifest.json
"routes": [
{
"name": "Routemain",
"pattern": "Routemain",
"target": [
"Targetmain"
]
},
{
"name": "main",
"pattern": "",
"target": "main"
}
]
It auto redirect to my main page, it should be login page. Sorry I'm new with sapui5.