Error: [$injector:unpr] Unknown provider: RestangularProvider <- Restangular <- ctrlAG

Issue

I have one app:

app.js:

angular.module('AngApp', [
        'angularGrid'
    ]);

My own restangular service.js:

var app = angular.module('AngApp'); 
app.factory('restService', ['Restangular', function (Restangular) {
        // make use of Restangular
    }
]);

and controller.js:

var app = angular.module('AngApp');
app.controller('ctrlAG', ['$scope',  '$http', '$log', '$mdDialog', 
'Restangular',function ($scope,$http, $log, $mdDialog, Restangular) {
        // make use of other modules and Restservice

    }
]);

html is:

<script type="text/javascript" src="ng/app.js"></script>
<script type="text/javascript" src="ng/restangular.js"></script>
<script type="text/javascript" src="ng/restService.js"></script>
<script type="text/javascript" src="ng/ctrlAG.js"></script>
<script type="text/javascript" src="ng/ctrlMetadata.js"></script>

angular 1.3.6 , restangular (latest).

What is the reason that i take this error? I Have checked the commonly taken mistakes from here
but non of them exists.

Solution

You didn’t inject module of Restangular service.

Try like this

angular.module('AngApp', ['angularGrid','restangular']);

Answered By – Anik Islam Abhi

Answer Checked By – Marilyn (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.