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

Can't load array of strings/numbers #4314

@Leonidas-from-XIV

Description

@Leonidas-from-XIV

Hi,

I've tried to access a resource via REST that looks like this: ["abc", "def"]. Unfortunately, this returns an object that looks like this: [{0: "a", 1: "b", 2: "c"}, {0: "d", 1: "e", 2: "f"}], in other words it iterates over the strings and converts them to objects. When trying the same with an array of [42, 23] I get as an result [{},{}].

This is due to https://github.com/angular/angular.js/blob/master/src/ngResource/resource.js#L488 which creates a new Resource which can't deal with strings (or numbers): https://github.com/angular/angular.js/blob/master/src/ngResource/resource.js#L416 because it uses copy which handles neither strings nor numbers.

Thanks to @Lukas-Stuehrk for debugging this.

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions