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

前端 未结 4 957
名媛妹妹
名媛妹妹 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 05:59

    You need to set the paramater isArray to true in your resource definition if you are returning an array from the server.

    var Subject = $resource('/api/TestAccounts/:action', { applicationId: 3 }, {
      'getSelect': { method: 'GET', isArray: true, params: { action: 'GetSelect' } }
    });
    

    See: AngularJS $resource API

提交回复
热议问题