[英]Compilation error in angular success method for ajax request
This is an angular app and I am trying to call a function on success of an ajax call.这是一个有角度的应用程序,我试图在 ajax 调用成功时调用一个函数。
Compiler error on lines 3-6 in the following code and I have no idea why, please explain where I have gone wrong.以下代码第 3-6 行的编译器错误,我不知道为什么,请解释我哪里出错了。
$http.get(ROOT_API+"webapi/public/events/" + $scope.appId + "/eventTypes").success(
function(data){
var sports = [];
data.forEach(sport -> {
sports.push({"name":sport})
});
$scope.sports = sports;
}
);
}
我一直在使用很多 Java,所以我没有使用我使用的胖箭头函数 -> 而是导致奇怪的编译错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.