N.Ayaz N.Ayaz - 1 month ago 12
AngularJS Question

Error: $injector:unknown provider

My service:

angular.module('app').factory('keretHttpSrv', function ($http, $state, $scope, $rootScope, $q, $localStorage) {
/*some code*/
return keretHttpService;
})


My controller,

angular.module('app.dashboard')
.controller('DashboardCtrl',
['$scope', 'keretHttpSrv', function ($scope, keretHttpSrv)
{
/*some code*/
}])


I have this error:


Error: $injector:unknown provider


How can I solve this problem?

Answer

there is no $scope for a factory

FIX

angular.module('app').factory('keretHttpSrv',  function ($http, $state, $rootScope, $q, $localStorage) {
/*some code*/
    return keretHttpService; 
})