angularjs - Angular nsResource creates an array of char arrays for REST string arrays -
i have web service controller serves "activity" data
get /api/activity/list /api/activity/1 /api/activity/activity-slug-name put /api/activity delete /api/activity/1
it serves "meta" data
get /api/activity/meta/dates /api/activity/meta/states
they work extremely using ngresource return json objects. /api/activity/meta/dates not
it returns array of strings
[ "2013-06-02t17:05:16z", "2013-06-07t17:05:16z", "2013-08-17t17:05:16z" ]
ngresource turns array of char arrays see: invalid result ngresource request string array
obviously split meta functions out form of activitymetaservice prefer keep together
my question is
is there way stop ngresource performing overzealous object decomposition?
or should rais bug angular?
thanks in advance
* update *
thanks mark comment. if had placed answer have accepted it, because points bug in angular , other 2 answers not fit current architecture.
while technical correct, no 1 has though of strings array of chars since mid 80s, c/c++ programmers aside :)
i have raised ticket on github angular.js project, reference below
our try use transformrequest
query: { method: 'get', isarray: true, transformresponse: function (data, headers) { var tranformed = []; [].foreach.call(eval(data), function (d) { tranformed.push({ name: d }); }); return tranformed; }
}
Comments
Post a Comment