有时angular-resource需要一个数组,但得到一个对象,反之亦然。然后我收到这样一条消息:
Error: [$resource:badcfg] Error in resource configuration. Expected response to contain an object but got an array如果我有3个、5个甚至10个Ajax请求,我不知道是哪一个发出了Angular抱怨。
我如何让它告诉我是哪个URL或资源让它心烦意乱?
发布于 2014-09-18 07:05:44
将资源中该url的isArray属性设置为true。resource docs
{ 'get': {method:'GET'},
'save': {method:'POST'},
'query': {method:'GET', isArray:true},
'remove': {method:'DELETE'},
'delete': {method:'DELETE'} };https://stackoverflow.com/questions/25901702
复制相似问题