Reputation: 1993
I have this loop to show a list of input text
<div ng-repeat="country in countries">
<input ng-blur="saveCountryName(country)" type="text" value="{{country.name}}">
</div>
in my controller
$scope.saveCountryName = (country) => {
console.log(country);
}
country is filled with the original value, how can I get the modified value?
Upvotes: 1
Views: 50
Reputation: 5396
In AngularJS you have all power of two-way data binding, no need to use a special function (saveCountryName
).
<div ng-repeat="country in countries">
<input type="text" ng-model="country.name" ng-model-options="{ updateOn: 'blur'}" />
</div>
Upvotes: 1