i have this simple problem that i can't really found a solution for it. so what i am willing to do is inserting to an array values from inputs.
so for example i have this empty array at my controller first :
$scope.contents = [
{name: "", value: ""}
] ;
and i have three input fields that each of them has a label and a value :
<label>1st Label</label>
<input type='text' value='1st Value' />
<label>2nd Label</label>
<input type='text' value='2nd Value' />
<label>3rd Label</label>
<input type='text' value='3rd Value' />
i want by clicking a button to add the label and the value of each input to the array and i want the ng-model name of the values and labels to be generated automatically so in the ng-model i want to put something like this ng-model=val[$index]
that iterates
so the result should be
$scope.contents = [
{label: "1st Label", value: "1st Value"},
{label: "2nd Label", value: "2nd Value"},
{label: "3rd Label", value: "3rd Value"}
] ;
Any help will be appreciated