Sto utilizzando il segmento del percorso angolare nella mia app angolare e un tentativo di configurare i segmenti da un feed JSON.
Ho problemi con questo, perché non riesco a capire come iniettare $http
nella funzione app.config
. Questo viene a mancare con Unknown provider: $http
myApp.config(["$http", "$routeSegmentProvider", function ($http, $routeSegmentProvider) {
/* setup navigation here calling $routeSegmentProvider.when a number of times */
}
Così, invece di iniettare $ http in config
, ho anche provato l'iniezione $routeSegmentProvider
in 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 */
}]);
Ho anche provato
myApp.run(["$http", "$routeSegmentProvider", function($http, $routeSegmentProvider)
ma ottengo Unknown provider: $routeSegmentProviderProvider <- $routeSegmentProvider
È possibile trovare la risposta qui: http://stackoverflow.com/questions/15937267/inject-service-in-app-config –
@DavidBohunek Penso di aver trovato questo esempio prima, ma non ero in grado di farlo funzionare per qualche motivo. Ho deciso di andare con la risposta cliff.meyers per ora. – gwin003