user1893769 user1893769 - 1 year ago 67
Javascript Question

Angular Js Bind Text box with JSON Array with Static Index

I have 5 fixed Textbox, I have a JSON Array which should be bind with Textbox. 0th index element will be bind with 1st textbox.

<input type="text" class="form-control col-md-5" ng-model="jsonArray[0].amount">

what should i need to put in ng-model?

in jsonArray have 5 Json Object but nothing will displayed in Textbox.

Answer Source

In controller you assign to a variable and bind it,


$scope.amount = jsonArray[0].amount;


<input type="text" class="form-control col-md-5" ng-model="amount">
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download