Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

$resource query action doesn't send right params to the server #1840

Closed
bitliner opened this issue Jan 19, 2013 · 2 comments
Closed

$resource query action doesn't send right params to the server #1840

bitliner opened this issue Jan 19, 2013 · 2 comments

Comments

@bitliner
Copy link

i described the issue here https://groups.google.com/forum/?hl=en-US&fromgroups=#!topic/angular/FUNJZ8S6hIw

@pkozlowski-opensource
Copy link
Member

In fact this issue is not linked to the $resourcebut rather to the forEach implementation that has a special treatment for objects that have numerical length property. Have a look at his plunker: http://plnkr.co/edit/O7Z2f7aruxqiX26MfVgR?p=preview

  • expected result: k1=>v1,length=>2,
  • actual result: 0=>undefined,1=>undefined,

@bitliner
Copy link
Author

I think that code must be changed from:
else if (isObject(obj) && isNumber(obj.length)) { for (key = 0; key < obj.length; key++) iterator.call(context, obj[key], key); }
in
else if (Array.isArray(obj) && isNumber(obj.length)) { for (key = 0; key < obj.length; key++) iterator.call(context, obj[key], key); }
at line 111 in angular.forEach

I'm making a pull request

@bitliner bitliner mentioned this issue Jan 23, 2013
gonzaloruizdevilla added a commit to gonzaloruizdevilla/angular.js that referenced this issue Feb 9, 2013
…like objects

fixes angular#1840
when an object has a numeric length property:
if an object has a length property with a number value of 0, it will
be considered like an array like object
if the value is positive and the object looks like a full dense array
with a property named as length minus one, it will be considered
like an array like object

Signed-off-by: Gonzalo Ruiz de Villa <[email protected]>
IgorMinar added a commit that referenced this issue Feb 11, 2013
Should handle JQLite, jQuery, NodeList and other objects like arrays
but not other generic objects or instances of user defined types
with length property.

Closes #1840
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants