Currently facing an issue with angular updating the focus of my interface after a bound variable change. There's an array of author objects being utilized, and I'm employing an ngRepeat to exhibit their names in inputs. Upon blur of the input, an httpRequest is triggered to validate the name. If it turns out to be correct, the entire author object is updated from the database.
The blur event and the httpRequest are functioning as expected. However, upon receiving the data and assigning it back to the model, the input for that particular author regains focus.
<input type="text" ng-repeat="author in authors" ng-blur="validateName($index)" ng-model="author.name" />
$scope.validateName = function(index) {
$http({
method: 'GET'',
url: 'someUrl',
responseType: 'text',
headers: {
"Content-Type": "application/json; charset=utf-8",
"Authorization": bearer
}
})
.then(function(r) {
$scope.authors[index] = r.data;
});
}