我正在使用 $resource 来显示一个 json 列表文件,并想知道它为什么会生成错误消息:
Unknown provider: $resourceProvider <- $resource
这是代码:
HTML:
<div ng-app="manage">
.....
<div class="widget-content" ng-controller="testCtrl">
{{test}}
</div>
应用程序.js
angular.module('manage',['ngResource']);
和controller.js
function testCtrl($scope,$resource) {
var dataService = $resource('/users/1/test.json');
$scope.test = dataService.get();
}
似乎它在 plunkr http://plnkr.co/edit/bJfJurl6Gtw3qRcn4ViW?p=preview上运行良好 但不适用于我的应用程序。我使用完全相同的结构..(即使加载角度和角度资源文件顺序)
我能注意到的唯一区别是 angularJS 版本(我在我的应用程序上使用 1.0.2),当然还有 json 文件。
我究竟做错了什么 ?
更新 :
我在 plunkr 上更改了角度版本。现在两边都一样