很抱歉,如果有重复的话,但实际上在StackOverflow上的类似问题上找不到答案。
这是代码:
http://plnkr.co/edit/IsdYMgcIznQ667ols67b?p=preview
我想要的是line 19
,我希望程序提醒我通过的号码,而当前它提醒我一个功能。数量应该是0
,1
,或2
,这取决于哪一个条目删除(Remove Student)
。
您的工厂方法接受两个参数,index
和callback
。以该顺序。
调用它时,只将其传递给一个函数。此函数接受index
和callback
。
相反,您需要将其传递给anindex
和ancallback
接受data
。
$scope.removeStudent = function(index) {
console.log(index);
studentFactory.removeStudent(index, function(data){ // this is what's different
console.log(data);
});
};
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句