Here's a simple question: how can I find all instances of $stateProvider.state
in my app.js, which is my AngularJS config file? In the past with ngRoute
, I could achieve this by using a similar approach in my .run()
block:
.run(function ($route) {
var someArray = [];
angular.forEach($route.routes, function (route, path) {
if (route.someKey) {
console.log(path); // handle route.someKey here!!!
someArray.push(route.someKey);
}
});
});
However, with the use of ui-router
in my app, it seems like I can't do something alike with $state
. I'm currently doing some research on this, but if you have a quick answer, please let me know!