Javascript 如何在填写ngrepeat之前生成空白表行

Javascript 如何在填写ngrepeat之前生成空白表行,javascript,angularjs,angularjs-ng-repeat,Javascript,Angularjs,Angularjs Ng Repeat,我对JavaScript比较陌生 angular .module('MainView'、['Utils'、'ngMaterial'])) .controller('MainCtrl'、['$scope'、'$timeout'、'$q'、'$log',函数($scope、$timeout、$q、$log){ var self=这个; self.keychain=null; self.keychain=[{description:'some description',couponCode:3767

我对JavaScript比较陌生

angular
.module('MainView'、['Utils'、'ngMaterial']))
.controller('MainCtrl'、['$scope'、'$timeout'、'$q'、'$log',函数($scope、$timeout、$q、$log){
var self=这个;
self.keychain=null;
self.keychain=[{description:'some description',couponCode:37678},{description:'some text',couponCode:23478,单价:300.99,总成本:300.99,操作:'move'}]
}]);

描述
优惠码
{{$index+1}}
{{item.couponCode | |'n/a'}
{{item.description | |'n/a'}}
删除

我无法运行您的代码段,您正在使用stockList keychain

所以我看到的第一件事是,您的输入使用value=“{{item.qty}}”,而您应该使用ng model=“item.qty”


请参见

您应该使用空值初始化股票列表

vm.stockList = [
    {qty: null, couponCode: null, description: null},
    {qty: null, couponCode: null, description: null},
]

它在这里工作。你漏掉了角锉。还有这么多不需要的代码

angular.module('MainView',[])
.controller('MainCtrl',['$scope',函数($scope){
var self=这个;
self.keychain=null;
self.keychain=[{description:'some description',couponCode:37678},
{描述:'some text',耦合代码:23478,单价:300.99,总成本:300.99,操作:'move'}];
}]);

描述
优惠码
{{$index+1}}
{{item.couponCode}
{{item.description}
删除