sorting - How to use orderBy in AngularJS (1.2) to sort, without having incomplete entries jump around -


okay i'm doing basic crud angularjs. here's view:

<table>     <tr ng-repeat=="person in persons | orderby:lastname">         <td>             {{person.firstname}}         </td>         <td>             {{person.lastname}}         </td>         <td>         </td>     </tr>     <tr>         <td>             <input ng-model="person.firstname">         </td>         <td>             <input ng-model="person.lastname">         </td>         <td>             <button ng-click="save(person)">save</button>         </td>     </tr> </table> 

the problem type new user inputs, position of row jumps around fits alphabetically. want happen, when user done typing , hits "save."

you should update binding of scope variable on blur, should @ ng-model-options

i'd suggest should go ng-model-options="{ updateon: 'blur' }" field mentioned in orderby filter

<input ng-model="person.lastname" ng-model-options="{ updateon: 'blur' }> 

note

for need update angular 1.3 +


Popular posts from this blog