Is it possible to configure AngularJS Routes with data from a JSON rest service?
Basically what I want to do is use this same data to generate a menu directive and the $routeProvider
module.config() will not accept injected services and module.run() does not seem like it mixes well with promise based data.
    var routeData = {
      routes    :
            [
                {
                    'routeUrl' : '/page1',
                    'title' : 'A home for Pizza',
                    'templateUrl' : '/Views/page1.html',
                    'controller' : 'AppCtrl'
                },
                {
                    'routeUrl' : '/page2',
                    'title' : 'Some YouTube video',
                    'templateUrl' : '/Views/page2.html',
                    'controller' : 'AppCtrl'
                },
                {
                    'routeUrl' : '/page3',
                    'title' : 'this is page 3',
                    'templateUrl' : '/Views/page3.html',
                    'controller' : 'AppCtrl'
                }
            ],
      defaultRoute : "/page1"
    };
overviewApp.config(['$routeProvider', function ($routeProvider) {
    var x, current;
    for (x in routeData.routes) {
        current = routeData.routes[x];
        $routeProvider.when(
            current.routeUrl,
            {
                templateUrl: current.templateUrl,
                controller: current.controller
            }
        );
    }
    $routeProvider.otherwise({
    redirectTo: routeData.defaultRoute
  });
}]);
 
     
    