javascript - bind array from template to controller with angular -


hi have problem bind data template controller angularjs

the first have object (edited)

$scope.data =  {                 } 

after bind html

<input ng-model="data.item.test[0].value" /> 

but controller

{     item: object() {         0: object() {value: "ok"}         } } 

what need

item = array(0: object()) 

how can it

change mode structure in controller:

$scope.data = {     "item": [] }; 

and in html use

<input ng-model="data.item[0].value" /> 

then model object become this:

{   "item": [     {       "value": "ok"     }   ] } 

demo: http://plnkr.co/edit/u66qjhyiduk668c54fob?p=preview


Comments