gpt4 book ai didi

angularjs - AngularJS $ resource错误-TypeError:对象#没有方法 'push'

转载 作者:行者123 更新时间:2023-12-03 11:31:49 25 4
gpt4 key购买 nike

我的 Controller 文件中包含以下内容:

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

Subject.getSelect({ applicationId: 3 },
function (resp) {
$scope.testAccounts = resp;
gridData = null;
}
);

我的服务器代码运行并返回:
[{"id":5,"name":"xxx"},{"id":6,"name":"yyy"}]

但是我收到以下错误:
TypeError: Object #<g> has no method 'push'
at copy (http://127.0.0.1:81/Scripts/angular.js:577:21)

有人知道我在做什么错吗?

最佳答案

我只是将MyService.get(...)更改为MyService.query(...),因为.get()需要一个对象,而.query()需要一个数组。

关于angularjs - AngularJS $ resource错误-TypeError:对象#<g>没有方法 'push',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15932422/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com