An unknown provider error of var "frameworks" appears in resolve, what is wrong? thanks! FrameworkService.loadFrameworks() return a JSON array from REST Service.
app.js
$routeProvider.when('/', {
templateUrl : "views/admin.html",
controller : "FrameworkController",
resolve : {
frameworks : function(FrameworkService) {
return FrameworkService.loadFrameworks();
}
}
});
FrameworkController.js
angular.module('app.controllers', []).controller(
'FrameworkController',
[ '$scope', 'FrameworkService', 'frameworks',
function($scope, frameworks) {
$scope.frameworks = frameworks;
} ]);
ERROR
Error: [$injector:unpr] Unknown provider: frameworksProvider <- frameworks
EDIT
The code showed here it's ok! The problem was in the FrameworkService, that do an asynchronous http request, so var frameworks wasn't injected.
You don't have a frameworks provider in your module, so the injector can't give you one. You need to create one be it a service, factory, etc. Depending on what you want.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.