I am using angular-route-segment in my angular app and an trying to configure the segments from a json feed.
I have having problems with this, because I can't figure out how to inject $http
into the app.config
function. This fails with Unknown provider: $http
myApp.config(["$http", "$routeSegmentProvider", function ($http, $routeSegmentProvider) {
/* setup navigation here calling $routeSegmentProvider.when a number of times */
}
So instead of injecting $http into config
, I also tried injecting $routeSegmentProvider
into myApp.run
myApp.run(["$http", "$routeSegment", function($http, $routeSegment) {
/* can use $http here to get data, but $routeSegment is not the same here */
/* $routeSegment does not have the when setup method */
}]);
I also tried
myApp.run(["$http", "$routeSegmentProvider", function($http, $routeSegmentProvider)
but I get Unknown provider: $routeSegmentProviderProvider <- $routeSegmentProvider