0

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 ?

Skary
  • 387
  • 1
  • 4
  • 18
  • Here is a good explanation why do you have to use ng-model instead of value in this situation: http://stackoverflow.com/questions/14410993/binding-ng-model-inside-ng-repeat-loop-in-angularjs – arman1991 Nov 26 '14 at 07:59

1 Answers1

1

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

   <input class="width100" type="text" ng-show="editMode" ng-model="expert.mail" />
arman1991
  • 1,166
  • 1
  • 18
  • 28
Kiran P
  • 299
  • 2
  • 11