angularJS 循环添加 ng-model

for(var index=1;index<7;index++){
    $scope["model_"+index] = index
}

//效果 = 

$scope.model_1 = 1
$scope.model_2 = 2
$scope.model_3 = 3
$scope.model_4 = 4
$scope.model_5 = 5
$scope.model_6 = 6
$scope.model_7 = 7

 

posted @ 2020-05-30 15:19  黑色白沙  阅读(258)  评论(0编辑  收藏  举报