angular.js - angularjs-ngResource 强制要求返回数据为object
天蓬老师
天蓬老师 2017-05-15 16:53:15
0
3
548

Error: [$resource:badcfg] Error in resource configuration for action query. Expected response to contain an array but got an object
query()方法要求服务端返回的是array类型,而我的后端返回的是一个对象(object)包含分页等数据,data成员才是post列表。
请问在不修改服务端的情况下如何解决这个问题?

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(3)
淡淡烟草味

Done. Just add a parameter when instantiating the Post model. Wow hahaha

大家讲道理

You can rewrite the query method, I already told you in the QQ group today

PHPzhong

Isn’t it better to just use get?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template