Vincent
Vincent

Reputation: 6188

Init element without ng-model

I have the following code

View

<tr ng-repeat="order in orders">
   <td>
<input type="number" ng-model="inputAantal"  />
<div class='small button' ng-click="amountDecrease( order.code ,inputAantal )">
</td>
</tr>

Controller


  $scope.orders = privates.orders;

Now I would like to initialise inputAantal with a value which is also stored in order. But how can I do this and still bind the second parameter of the amountDecrease function to the input value? I could initialize all input fields in my controller but then I would lose my binding with the parameter of method amountDecrease.

Upvotes: 0

Views: 136

Answers (1)

AlwaysALearner
AlwaysALearner

Reputation: 43947

<tr ng-repeat="order in orders">
    <td>
        <input type="number" ng-model="order.value"  />
        <div class='small button' 
        ng-click="amountDecrease(order.code, order.value)">
    </td>
</tr>

Upvotes: 1

Related Questions