I want to add some routes dynamically to router. But it throws the following error:
A name has to be specified for every route - EventProvider sap.ui.core.routing.Router A @ sap-ui-core.js:88
The code that I used is as following:
for (var i = 0; i < aRoutes.length; i++) {
var _name = aRoutes[i].name,
_pattern = sPatternPrefix + aRoutes[i].pattern,
_target = aRoutes[i].target;
var oRoute = new sap.ui.core.routing.Route(oRouter, {
name: _name,
pattern: _pattern,
target: _target
});
oRouter.addRoute(oRoute, oParent);
}
What could be the reason, While all name parameter has a valid string?
The error is not thrown when the Route is created, but it's thrown when I want to use addRoute function.