0

I want to push each blank record in $scope.planlist=[] and iterate over in html to show its template but when i fill record each record shows identical behaviour means each property cant bind with index may be means properties cant uniquely defined

$scope.listOfPlans=[];

$scope.planrecord={name:"",age:""};

pushing like this

 $scope.listOfPlans.push(planrecord);

I want to fill each record in template so that each property can saved in unique list or object in respective index of array

nisar
  • 1,055
  • 2
  • 11
  • 26
user5639481
  • 7
  • 1
  • 3

1 Answers1

0

you should create new object in that function body. for more info see this Angular-Formly : Adding Form fields dynamically on user click

also see this answer What is the scope of variables in JavaScript?

like this.

 $scope.add = function(){
   var newObject = {name:"",age:""};
   $scope.listOfPlans.push(newObject);
 }
Community
  • 1
  • 1
Hadi J
  • 16,989
  • 4
  • 36
  • 62