ui-mask
ui-mask copied to clipboard
Process viewValue within ng-repeat
Code
<div ng-app="angularApp" ng-controller="AngularCtrl" ng-init='models=[{data : "12"},{data : "34"},{data : "56"}]'>
ng-repeat
<div ng-repeat="model in models">
<input type='text' ng-model="model.data" ui-mask="9-9" model-view-value="true">
<span>Model value: {{model.data}}</span>
</div>
<p>without ng-repeat</p>
<input type='text' ng-model="models[1].data" ui-mask="9-9" model-view-value="true">
<span>Model value: {{models[1].data}}</span>
</div>
result:
ng-repeat
Model value: 12 <-- wrong! (must be 1-2)
Model value: 3-4
Model value: 56 <-- wrong! (must be 5-6
without ng-repeat
Model value: 3-4
Code also available at link http://jsfiddle.net/9o9bke9c/