Skip to main content
Corrected for accuracy
Source Link
richbai90
  • 5.2k
  • 7
  • 54
  • 95

From the documentation:

Action isArray

$resource(url,[paramDefaults]isArray – {boolean=} – If true then the returned object for this action is an array,[actions]); see returns section.

According to your code isArray = true. Set it to false and you can use an object instead of an array.

app.factory('itemService', function ($resource) {
return {
        getCategoryAndBrand   :  $resource("/user/categories_brands" ,{},{ TypeGetCategoryAndBrand:{method: 'get', isArray:true}})
    };
});

It's expecting you to pass in the parameters as an array not an object

from your code

$resource("/user/categories_brands" ,{},{ TypeGetCategoryAndBrand:{method: 'get', isArray:true}})

If the documentation is to be believed than with the error your getting I'd try to pass this in the form of an array and not an object to see if you get the same response.

From the documentation:

$resource(url,[paramDefaults],[actions]);

It's expecting you to pass in the parameters as an array not an object

from your code

$resource("/user/categories_brands" ,{},{ TypeGetCategoryAndBrand:{method: 'get', isArray:true}})

If the documentation is to be believed than with the error your getting I'd try to pass this in the form of an array and not an object to see if you get the same response.

From the documentation:

Action isArray

isArray – {boolean=} – If true then the returned object for this action is an array, see returns section.

According to your code isArray = true. Set it to false and you can use an object instead of an array.

app.factory('itemService', function ($resource) {
return {
        getCategoryAndBrand   :  $resource("/user/categories_brands" ,{},{ TypeGetCategoryAndBrand:{method: 'get', isArray:true}})
    };
});

It's expecting you to pass in the parameters as an array not an object

from your code

$resource("/user/categories_brands" ,{},{ TypeGetCategoryAndBrand:{method: 'get', isArray:true}})

If the documentation is to be believed than with the error your getting I'd try to pass this in the form of an array and not an object to see if you get the same response.

added link to doc resource
Source Link
mhitza
  • 5.7k
  • 2
  • 32
  • 52
added link to doc resource
Source Link
psxls
  • 6.9k
  • 6
  • 34
  • 50

From the doucmentationdocumentation:

$resource(url,[paramDefaults],[actions]);

It's expecting you to pass in the parameters as an array not an object

from your code

$resource("/user/categories_brands" ,{},{ TypeGetCategoryAndBrand:{method: 'get', isArray:true}})

If the documentation is to be believed than with the error your getting I'd try to pass this in the form of an array and not an object to see if you get the same response.

From the doucmentation:

$resource(url,[paramDefaults],[actions]);

It's expecting you to pass in the parameters as an array not an object

from your code

$resource("/user/categories_brands" ,{},{ TypeGetCategoryAndBrand:{method: 'get', isArray:true}})

If the documentation is to be believed than with the error your getting I'd try to pass this in the form of an array and not an object to see if you get the same response.

From the documentation:

$resource(url,[paramDefaults],[actions]);

It's expecting you to pass in the parameters as an array not an object

from your code

$resource("/user/categories_brands" ,{},{ TypeGetCategoryAndBrand:{method: 'get', isArray:true}})

If the documentation is to be believed than with the error your getting I'd try to pass this in the form of an array and not an object to see if you get the same response.

Source Link
richbai90
  • 5.2k
  • 7
  • 54
  • 95
Loading