Response does not match configured parameter:

I am getting following error in angular $resource: error description

Error: error:badcfg Response does not match configured parameter: Error in resource configuration for action `array`. Expected response to contain an object but got an {2}

I initialized the ng app as follows:

var appRoot = angular.module('smapp', ['ngRoute', 'ui.bootstrap', 'ngResource']);

The service:

appRoot.factory('ProgramsResource', function ($resource) { return $resource('Home/Program', {}, { Program: { method: 'get', isArray: false } }) });

In my controller:

appRoot.controller('ProgramCtrl', function ($scope, ProgramsResource) { $scope.searchPrograms = function () { $scope.Programs = ProgramsResource.query( { TotalItems: $scope.TotalItems, ItemsPerPage: $scope.ItemsPerPage, PageNo: $scope.CurrentPage }); }; $scope.TotalItems = 175; $scope.ItemsPerPage = 20; $scope.CurrentPage = 1; $scope.searchPrograms(); });

Json I am sending from the server in respons:


The angular $response throws error for above json

But if I do not send "List" array within json and send simple json as follows, everything works fine then:


I am new to angular and don't know what exactly I am doing wrong.


Instead of doing

$scope.Programs = ProgramsResource.query(


$scope.Programs = ProgramsResource.get(

query function expects the response to be an array, where as get expects a object. Since you are returning object use get.

The default setting for query function is isArray:true. This flag helps angular to de-serialize your response into either object or array. See resource documentation.

<strong>Also note:</strong> When you change default settings for a <strong>query</strong> function like the following, you will encounter this error if you do not define isArray as true. So always add isArray: true when you change the default settings for query:

var res = $resource('/api/userinfoes/:Id', { Id: "@Id" }, { 'query': { method:'GET', headers: { 'Authorization': 'Bearer ' + token }, isArray:true} });


  • Undefined error when trying to use ngDialog
  • How to edit DsoFramer 1.3?
  • Directive - Dependency Injection do not resolve (controllerAs syntax)
  • Printing Flickr API Response to Console AngularJS
  • How to get BreezeJS to talk to MySQL DB with Angular + Node?
  • How can I read a CSV more quickly in R?
  • Android Nested dialog - Specified child already has a parent
  • AngularJS - UI Router stateChangeSuccess event not firing
  • Chaining multiple filters with AngularJS
  • how to remove Unexpected request: GET data.json?
  • How to convert String to the name of the Array?
  • ANGULAR $http.put REST
  • Response does not match configured parameter:
  • Android mkdirs() sdcard do not work
  • Installing Perl6 and Panda on Ubuntu 15.10. Problems with bootstrap.pl
  • Can my PDF ping my server when it is opened?
  • Bootstrap (v3.3.4) glyphicons not displayed in IE when refresh page (F5)
  • Memory error in python- how to use more memory
  • Differences in dis-assembled C code of GCC and Borland?
  • Android full screen on only one activity?
  • Algorithm for a smudge tool?
  • Accessing IRQ description array within a module and displaying action names
  • Trying to switch camera back to front but getting exception
  • jQuery tmpl and DataLink beta
  • bootstrap to use multiple ng-app
  • Free memory of cv::Mat loaded using FileStorage API
  • Angular 2 constructor injection vs direct access
  • Checking variable from a different class in C#
  • Django query for large number of relationships
  • Programmatically clearing map cache
  • Why is Django giving me: 'first_name' is an invalid keyword argument for this function?
  • Binding checkboxes to object values in AngularJs
  • How can I use `wmic` in a Windows PE script?
  • Unable to use reactive element in my shiny app
  • Net Present Value in Excel for Grouped Recurring CF
  • How to push additional view controllers onto NavigationController but keep the TabBar?
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?