0

I have angular form which using to create some invoice, i need to add functionality to edit invoice, I am get data from db using $http and put that data in array on client side. My qusetion is how to populate data in input and select2 field from my array to not break a scope?

1

1 Answer 1

2

I guess the array contains the lines details of the invoice (ie. $scope.invoiceDetail), you simply have to parse it with ng-repeat :

<form name="invoiceForm" novalidate>
  <div ng-repeat="line in invoiceDetail">
    <input type="text" name="itemRef" ng-model="line.reference" required>
    <input type="text" name="itemQty" ng-model="line.quantity" required>
  </div>
</form>

  $scope.invoiceDetail = [
    {reference: 123, quantity: 1},
    {reference: 456, quantity: 3},
    {reference: 789, quantity: 5},

  ];

Sorry if i misunderstood your question.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.