【发布时间】:2015-04-23 09:53:31
【问题描述】:
我的控制器中有一个名为this.selectedCourses 的数组。这个数组有一些项目在我的视图中显示为一个列表。
经过一些步骤,我有这个:
this.checkAddedCourses = function(studentCourses){
...
if(repeatedCourses.length != 0){
sweetAlert({
title: title,
text: text + ' ' + courseList,
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: confirmButtonText,
closeOnConfirm: false,
html: true
},
function(){
angular.forEach(repeatedCourses, function(repeatedCourse){
this.removeCoursePurchase(repeatedCourse);
}.bind(this));
swal("Deleted!", "Your purchase has been refreshed.", "success");
}.bind(this));
}
}
当用户单击“删除”按钮时,项目会从数组中很好地删除,我已经检查过了,但在我看来,在我对该数组执行某些操作之前,我仍然会看到这些项目。就像删除元素后不刷新数组一样。
谢谢。
PD:sweetAlert 是一个警报库。
【问题讨论】:
标签: javascript arrays angularjs data-binding