AngularJs:未知提供者:$resourceProvider <- $resource <- DonorerCtrl

AngularJs: Unknown provider: $resourceProvider <- $resource <- DonorerCtrl

我正在尝试为我的 angular 应用程序加载 "donors" 列表。我从 API 获取数据,但我没有按照我想要的方式工作。我收到此错误:

$resourceProvider <- $resource <- DonorerCtrl

在我的 DonorerCtrl class 我有以下代码:

angular.module("testApp").controller("DonorerCtrl",
function($scope, $http, $resource) {
    console.log("Test fra donorerCtrl");

    $scope.donorerResource = $resource("http://bloodadmin.cloudapp.net/api/users/:donorid"),
    {id: "@donorid"}, { update: {method: "PUT"}};

    $scope.donorerVisits = $scope.donorerResource.query();

    $http (
        {
            method: "GET",
            url: "http://bloodadmin.cloudapp.net/api/donors"
        }).success(function(data) {
            $scope.donorerVisits = data;
        }).error(function() {
            alert("error");
        });

    $scope.donorerVisits = [];

});

我尝试使用以下代码将其加载到我的 HTML 文件中:

<div class="form-group col-lg-12">
    <table class="table">
        <thead>
        <tr>
            <th>Fornavn</th>
            <th>Efternavn</th>
            <th>Køn</th>
            <th>Fødselsdag</th>
            <th>Læs mere</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="visit in donorerVisits">
            <td>{{visit.firstname}}</td>
            <td>{{visit.lastname}}</td>
            <td>{{visit.sex}}</td>
            <td>{{visit.age}}</td>
            <td><button class="btn btn-default">Læs mere</button></td>
        </tr>
        </tbody>
    </table>
</div>

在我的索引 html 中,我加载了这些 JS 文件:

<!-- JS -->
<script src="libs/angular.js" type="text/javascript"></script>
<script src="libs/angular-ui-router.min.js" type="text/javascript"></script>
<script src="libs/angular-resource.js" type="text/javascript"></script>

<!-- Angular Custom -->
<script type="text/javascript">
    angular.module("testApp", ['ui.router']);
</script>

<script src="js/controllers/HjemCtrl.js"></script>
<script src="js/controllers/DonorerCtrl.js"></script>
<script src="js/controllers/BlodCtrl.js"></script>
<script src="js/navigation.js"></script>

尝试:

angular.module("testApp", ['ui.router', 'ngResource']);