你能告诉我为什么我的行没有被删除吗?我做了一个演示,我添加了学生的名字。我能够添加学生的名字。现在我有两个问题,我不能删除行和编辑。你能告诉我哪里错了吗?
是我的演示http://plnkr.co/edit/1lem6t4h7b6Eefsz32t6?p=preview
app.controller("studentcntr",['$scope',function(scope){
scope.studentDetail=[];
scope.addStudent=function(){
bootbox.prompt("Enter Name!",function(res){
console.log(res);
if(res==null){
}else {
scope.studentDetail.push({ name: res });
}
scope.$digest();
});
};
scope.editRowName=function (name) {
// body...
// alert(name);
setTimeout(function() {
$('.bootbox-input').val(name);
}, 10);
}
scope.deleteRow=function (id) {
// body...
alert('s'+id)
$('#'+id).remove();
}
}])
我可以删除行,但问题是,当我删除行,并添加新的名称,它创建再次删除行为什么?为什么现在是永久删除
为什么现在是永久删除
因为你没有从scope.studentDetail
中删除它,所以它是持久的。
变化