0
我想刪除我的表中的空行。我必須將它設置爲我的控制器中的空對象,或者我得到一個錯誤消息Cannot read property 'push' of undefined. Note that I do not get this error in my plunkr when I comment out the empty object in the controller. not sure why i dont need it in the plunkr but I need it in my project. [plunkr][1]
如何刪除初始空錶行
$scope.question = {
options: [{}],
option: { number: ''}
};
$scope.addOption = function() {
$scope.question.options.push($scope.question.option);
//clear out the option
$scope.question.option = {number: '', description: ''}
}
你能告訴我怎麼它適用於本http://plnkr.co/edit/wtxQT4cJ1oFYkMHw0ji4?p=preview – texas697 2014-10-27 15:26:46
@ user3919120請參閱http://plnkr.co/edit/n8sEWMLuxvZkVGBhjl6h?p=preview – sylwester 2014-10-27 15:31:51