Good day.
There is a collection of routes of length N. The i-th element contains properties, say, url and name. Required to configure on the main page routes to url'am specified in this array.
In HTML, as I understand it, a code like this comes out:
<ul> <li ng-repeat="route in routes"><a ui-sref="{{route.url}}">{{route.name}}<a></li> </ul> The i-th ui-sref points to the i-th url.
I can not figure out how in this case to register in the config $ stateProvider. Normal code like this
$stateProvider .state('page0', { url: 'page0', templateUrl: 'page0.htm', }) as I understand it, does not fit here, because At the configuration stage, there is no routes collection yet. How to do this at runtime dynamically? Ideally it would be in the form of a function that passes through the routes collection, and adds routes to $ stateProvider
routescollection change often? If not often, then I see no reason to fill$stateProviderdynamically. - Stepan Kasyanenko