Error: Unknown provider: $resourceProvider

I am getting this error and I tried different methods, but still I have not found any solution.
This is my code:


.service('myservice', function($resource) {

  var pendings = $resource('myUrl2', {methode: 'GET', isArray:true});
  var items; 

  var myPo='rawad al bo3bo3';
  var quantity;
  var barcode;

  return {
    getItems: function() {
      items = $resource('myUrl', {methode: 'GET', isArray:true});

And this is my controllers:

.module('myApp.controllers', [])
.controller('ReceiveCtrl', ['$scope','myservice', function ($scope,myservice) {      


<html lang="en" ng-app="myApp">
    <meta charset="utf-8">
    <title>My AngularJS App</title>
    <!-- <link rel="stylesheet" href=""> -->

    <ul class="menu">
      <li><a href="#/Receive">view1</a></li>
      <li><a href="#/Pending">view2</a></li>

    <div ng-view></div>


In the controller I can’t access the variable coming from my services… so the alert message won’t work and I get this error

Error: Unknown provider: $resourceProvider <- $resource <- myservice

You have to include angular-resource.js file and load ngResource module: angular.module('app', ['ngResource'])

For more details check “Installation” section inside the documentation for the $resource service:$resource

The service module also require the resource.


should be


and also the controller needs to know about your service-module

angular.module('myApp.controllers', [])


angular.module('myApp.controllers', ['','myApp.filters', 'myApp.directives'])

and techincally, your motherModule does not require only the myApp.controllers

angular.module('myApp', ['','myApp.filters', 'myApp.directives' 'myApp.controllers']).  


angular.module('myApp', ['myApp.controllers']).  

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .
Read More:   How to add custom javascript to WordPress Admin?

Similar Posts