1
<tr ng-repeat="item in groups">
    <td hidden><input type="hidden" value="{{item.id_group}}" /></td>
    <td><input type="text" value="{{item.description}}" class="form-control" /></td>
    <td>
        <a href="" ng-click="editGroup(item)">Edit |</a>
        <a href="" ng-click="deleteGroup(item)">Delete</a>
    </td>
</tr>

So this code was supposed to show values in a table and when the user changes anything in the description and click on Edit, it should POST the new value to the server. Instead it's posting the old value, I need some help please to identify why this is happening.

1
  • You should really be using buttons for those actions. Anchors are for navigation. Commented Mar 10, 2020 at 12:52

1 Answer 1

1

Try using Ng-model

<tr ng-repeat="item in groups track by $index">
    <td hidden><input type="hidden"  ng-model="groups[$index].id_group" /></td>
    <td><input type="text" ng-model="groups[$index].description" class="form-control" /></td>
    <td>
        <a href="" ng-click="editGroup(item)">Edit |</a>
        <a href="" ng-click="deleteGroup(item)">Delete</a>
    </td>
</tr>
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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.