0

I am using angular js -1.2

I have a html page which is having input type =text

<input type="text" ng-model="todo.policy.polno"  size="16"
         placeholder="policy no" ng-value="{{todo.policy.polno}}"> 

my DATA looks like this

  $scope.todo= [
    {
  "policy": {
    "polno": "VPC000111568954",
    "product code": "VPC",
    "date": "17/02/1990",
........
    }
    ]

on load i want to display "VPC000111568954" in textbox1 "vpc" in textbox2 etc there are many text boxes and and i have object inside object also in JSON

1 Answer 1

1

The code your provided looks correct, since you only provided some of your code there is no way to tell where exactly the problem is. Since todo is an array are you making sure to use the ngRepeat to iterate through it. It should look something like this:

<div ng-repeat="item in todo">
    <input type="text" ng-model="item.policy.polno"  size="16" placeholder="policy no" /> 
</div>

Note there is no need for ngValue that directive is for checkboxes and radio buttons.

You can see a working example here: http://jsfiddle.net/luisperezphd/dzATm/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.