我正在使用AngularJS製作應用程序。
突然我得到了這個錯誤。
Error: [$rootScope:infdig] http://errors.angularjs.org/1.6.4/ $rootScope/infdig?p0=10&p1=%5B%5D
見我的代碼:
HTML:
<body ng-app="invApp" ng-controller="InvoiceController as ctrl">
<span ng-repeat="code in ctrl.codes">{{ getProduct(code) }}</span>
</body>
JS:
var app = angular.module("invApp", []);
app.controller("InvoiceController", function ($scope, $http) {
$scope.codes = ["KKS", "KKB", "SNS"];
$scope.getProduct = function (code) {
$http({
method: 'GET',
url: '../api?action=getproduct&code='+code
}).then(function successCallback(response) {
var something = response.data;
});
return something;
};
});
什麼是代碼,爲什麼是你返回data2 – ukn