user1893769 user1893769 - 21 days ago 7
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

In controller you assign to a variable and bind it,

Controller

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

HTML

<input type="text" class="form-control col-md-5" ng-model="amount">