I am not sure if there is a more "Angular" way to solve this but here is what I did.
1)Rather than store the values as .json, I simply created a .js file where I set a variable equal to the route data.
2) I used a script tag in the layout of my Angular.js application that imports the .js file that I stored on S3.
3) In the config block I created the states required like so:
@newco.config(['$provide', '$locationProvider', '$httpProvider', '$stateProvider', '$urlRouterProvider',
($provide, $locationProvider, $httpProvider, $stateProvider, $urlRouterProvider) ->
$locationProvider.html5Mode(false);
$locationProvider.hashPrefix('!');
$urlRouterProvider.otherwise('/404')
_.each routes.routes, (route) ->
$stateProvider
.state(route, {
url: if route == '/' then route else "/" + route,
templateUrl: '/pages/home/new_index',
controller: 'NewHomeController',
resolve:{
pageData: (cmsService) ->
cmsService.pageData route
basePlan: -> 'default'
customerCategoryId: -> 'domestic'
}
})
$stateProvider
.state('/404', {
templateUrl: '404.html'
})
])
If there is a better way to do this I would certainly be interested in hearing it because I almost feel like my solution is 'hackey' but I simply can't find a more appropriate solution because the routes are initialized in during the config block which forbids the use of services.
If someone has a better idea or a reason why my solution is not ideal I would love to hear it.