我在我的AngularJS应用中收到了以下信息:
我的app.js
Error: [$injector:unpr] Unknown provider: $resourceProvider <- $resource <- Item
http://errors.angularjs.org/1.3.8/$injector/unpr?p0=%24resourceProvider%20%3C-%20%24resource%20%3C-%20Item
at http://localhost:49717/Scripts/angular.js:63:12
at http://localhost:49717/Scripts/angular.js:3994:19
at Object.getService [as get] (http://localhost:49717/Scripts/angular.js:4141:39)
at http://localhost:49717/Scripts/angular.js:3999:45
at getService (http://localhost:49717/Scripts/angular.js:4141:39)
at Object.invoke (http://localhost:49717/Scripts/angular.js:4173:13)
at Object.enforcedReturnValue [as $get] (http://localhost:49717/Scripts/angular.js:4035:37)
at Object.invoke (http://localhost:49717/Scripts/angular.js:4182:17)
at http://localhost:49717/Scripts/angular.js:4000:37
at getService (http://localhost:49717/Scripts/angular.js:4141:39) <div ng-view="" class="ng-scope">
我的app.js
'use strict';
var SalesApp = angular.module('SalesApp', ['ngRoute']).
config(['$routeProvider', function ($routeProvider) {
$routeProvider.
when('/', { controller: ItemCtrl, templateUrl: 'item.html' }).
otherwise({ redirectTo: '/' });
}]);
SalesApp.factory('Item', function ($resource) {
return $resource('/api/Item/:iid', { iid: '@iid' }, { update: { method: 'PUT' } });
});
var ItemCtrl = function ($scope, $location, Item) {
$scope.items = Item.query();
};
我加载的脚本
<script src="Scripts/jquery-1.9.1.js"></script>
<script src="Scripts/angular.js"></script>
<script src="Scripts/angular-resource.js"></script>
<script src="Scripts/app.js"></script>
<script src="Scripts/angular-resource.js"></script>
<script src="Scripts/angular-sanitize.js"></script>
<script src="Scripts/angular-animate.js"></script>
<script src="Scripts/angular-touch.js"></script>
<script src="Scripts/angular-route.js"></script>
不知道可能出了什么问题?为了简单起见,我将ItemCtrl保留在app.js文件中,否则我不知道该怎么做。