Skip to content Skip to sidebar Skip to footer

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 `a

Solution 1:

Instead of doing

$scope.Programs = ProgramsResource.query(

Use

$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.

Also note: When you change default settings for a query 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}
            });

Post a Comment for "Response Does Not Match Configured Parameter:"