TheCuBeMan
TheCuBeMan

Reputation: 2473

AngularJS issue - "Error: Unknown provider:"

I'm starting off with a very simple AngularJS application (got a very, very basic knowledge in this), with the following code and content:

    <html>
    <head>
    <script type="text/javascript" src="angular.min.js"></script>
    <script type="text/javascript" src="angular-resource.min.js"></script>

<script type="text/javascript">
var app = angular.module('myModule', []).config(function ($interpolateProvider) {
    $interpolateProvider.startSymbol('{@').endSymbol('@}');
});
app.controller('myCtrl', ['$scope', '$resource', '$http', function ($scope, $resource, $http) {

    document_ready($scope, $resource, $http);
    angular.element(document).ready(function () {
        $http({
            method: 'GET',
            url: '/networks',
            data: {}
        }).success(function (result) {
            $scope.network = result;
        });
    });
}]);
    </script>

    </head>

    <body ng-app="myModule">
    <div ng-controller="myCtrl">
    ...
    </div>

    </body>
    </html>

For this code, I get the following error message when running in the browser:

Error: Unknown provider: $resourceProvider <- $resource

What am I missing here? What am I doing wrong?

(and please keep in mind that I'm an absolute beginner to AngularJS)

Thanks in advance.

Upvotes: 0

Views: 759

Answers (1)

elclanrs
elclanrs

Reputation: 94131

You forgot to add the resource module dependency:

.module('myModule', ['ngResource'])...

Upvotes: 1

Related Questions