我在 app.js 中声明了以下内容
angular.module('adminApp', ['ngGrid','ngResource']);
在 data.js 中
angular.module('adminApp', [])
.factory('testAccountService', function ($http) {
var TestAccount = {
在 GridCtrl.js
angular.module('adminApp',[])
.controller('GridCtrl', function ($scope, $http, $resource, testAccountService) {
$scope.selectedTestAccount = null;
我正在像这样加载我的脚本:
<script src="~/Scripts/jquery-1.9.1.min.js"></script>
<script src="~/Scripts/angular.min.js"></script>
<script src="~/Scripts/angular-resource.min.js"></script>
<script src="~/App/admin/services/Data.js"></script>
<script src="~/App/admin/controllers/GridCtrl.js"></script>
当我运行它时,它给了我一个错误消息:
Error: Unknown provider: $resourceProvider <- $resource
at Error (<anonymous>)
at http://127.0.0.1:81/Scripts/angular.js:2682:15
at Object.getService [as get] (http://127.0.0.1:81/Scripts/angular.js:2810:39)
at http://127.0.0.1:81/Scripts/angular.js:2687:45
我这样做的方式有问题吗?我对如何设置服务感到困惑,但我看不出有什么问题: