【发布时间】:2016-04-15 12:24:04
【问题描述】:
我使用角度 $timeout 作为,
$scope.alltexts = ["hii" , "hello" , "hehe"]
var sendtime = 60000
for (var i = 0; i < $scope.alltexts.length; i++) {
var text = $scope.alltexts[i]
$setTimeout(function() {}, (function(){$scope.addtext(text)}, sendtime + (i * 60000)));
};
$scope.addtext = function(text){
console.log(text)
}
但每过一分钟它只会安慰“呵呵”。意味着它只考虑最后一个值。请让我知道我应该如何获得正确的结果。
【问题讨论】: