Skary
Skary

Reputation: 417

AngularJS Model is not updating

i got a Model in a ng-repeat :

<tr ng-repeat="expert in experts">
                <td>{{expert.expertName}}</td>
                <td ng-mouseleave="editMode = false">
                    <span ng-hide="editMode" ng-click="editMode = !editMode">{{expert.mail}}</span>
                    <input class="width100" type="text" ng-show="editMode" value="{{expert.mail}}" />
                </td>
                <td><input class="width100" type="checkbox" ng-model="expert.locked" ng-click="showSaveButton = ! showSaveButton"/></td>
                <td class="width100">
                    <input type="button" class="btn btn-primary btn-success" ng-show="showSaveButton" value="SAVE" ng-click="confirmSave(expert)" />
                    <input type="button" class="btn-warning btn-primary btn" value="GENERATE" ng-click="" />
                </td>
            </tr>

So the Problem is here :

<td ng-mouseleave="editMode = false">
                    <span ng-hide="editMode" ng-click="editMode = !editMode" ng-animate>{{expert.mail}}</span>
                    <input class="width100" type="text" ng-show="editMode" value="{{expert.mail}}" />
                </td>

When i enter the edit mode, i can edit the input field. When i leave, the span is not updating.

Any suggestions ?

Upvotes: 0

Views: 73

Answers (1)

Kiran P
Kiran P

Reputation: 299

you can use ng-model instead of value ={{expert.email}}

   <input class="width100" type="text" ng-show="editMode" ng-model="expert.mail" />

Upvotes: 1

Related Questions