AngularJS $resource error - TypeError: Object # has no method 'push'

前端 未结 4 960
名媛妹妹
名媛妹妹 2020-12-15 05:20

I have the following in my controller file:

var Subject = $resource(\'/api/TestAccounts/:action\', { applicationId: 3 }, {
   \'getSelect\': { method: \'GET\         


        
4条回答
  •  一向
    一向 (楼主)
    2020-12-15 06:17

    By default, GET expects an object {}, QUERY expects an array[]. In your case, Web API returns an array for GET, so you need to set isArray flag for GET as true. If your Web API returned an object, then you would not need to reset that flag because it is GET's default behavior.

提交回复
热议问题