How to create an Array with AngularJS's ng-model

前端 未结 6 2053
感情败类
感情败类 2020-12-01 02:30

I\'m trying to create an array holding telephones, i have this code




        
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-01 03:15

    How to create an array of inputs with ng-model

    Use the ng-repeat directive:

    The DEMO

    angular.module("app",[])
    .controller("ctrl",function($scope){
      $scope.count = 3;
      $scope.telephones = [];
    })
    .filter("range",function() {
      return (x,n) => Array.from({length:n},(x,index)=>(index));
    })
    
    
        
        
    {{telephones}}

提交回复
热议问题