1

I have 2 tables i want to push the row of the first table to the second. table 1 :

<table>

        <tr ng-repeat="row in items">
        <td>{{row.PRODUCTDESCRIPTION}}</td>
        <td><input type="text" ng-model="quantity[$index]"></td>
        </tr>
        </table>
<button ng-click="pushRows(row)"> </button>

table 2 :

<table>
<tr ng-repeat="row in products">
<td>{{row.PRODUCTDESCRIPTION}}</td>
<td><input type="text" ng-model="quantity[$index]"></td>
</tr>

i need to push the row in table 1 to the table 2 (my problem is how to push the input type text with its value)

4
  • 1
    You are using the same model for both table. When typing in the first row of the first table you will also fill the first row of the second table. Is it what you want ? Commented Sep 12, 2016 at 7:15
  • yes true, when i click the button, the input text of the second table should take the same value inserted in the first table Commented Sep 12, 2016 at 7:20
  • 1
    I jsfiddled your code : jsfiddle.net/53q608es . Why your button is outside the table ? shouldn't be in the ng-repeat loop ? As there is one text input per row, if you click on the button, where do you want to insert that input text ? beside the second's table input text at the same $index ? Commented Sep 12, 2016 at 8:03
  • i made the button to take all selected rows with ng-class selected that's working i am able to push the selected rows. But i want to insert quantity and this quantity is pushed with every row, like chocolate 15200(qty) this qty is pushed with the row Commented Sep 12, 2016 at 8:06

1 Answer 1

1

You can use ng-model and create a new property on all the items.

plunker Example

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

2 Comments

you are so close to my case, I am able to push my selected row with the input text. But in this plunk if you select product 1 and give value like 55 and you push... the input is pushing but without the value, i want the value that's my problem
that's working, this my third question about this problem Thank you so much !

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.