An input field is being generated by ng-repeat. The input tag includes ng-model and ng-blur. The ng-blur action is not triggered and the console doesn't show any errors.
The HTML is generated by a Zend Framework 3 app. I'm using angularjs 1.7.8 and jquery 3.1.0.
Here is the body of the web page
<body ng-app='byDomainApp' ng-controller='ByDomainCtrl'>
<center>
<h2>Maintenance By Domain</h2>
</center>
<p>You may edit/correct any of the following details. Note that an
update will be ignored if the email address is changed to one that has
been tried previously.</p>
<div class='row'>
<div class='col-xs-3'>
Choose a domain: <select class='form-control' ng-model="myDomain"
ng-change="domainUsers(myDomain)"
ng-options="domain.domain_name for domain in domains track by domain.domain_id"></select>
<p ng-hide 'message=null' >
<br> <br>{{message}}
</p>
</div>
</div>
<div class='row'>
<div class='col-xs-2'>Name</div>
<div class='col-xs-2'>Email</div>
<div class='col-xs-2'>Company</div>
<div class='col-xs-2'>Job title</div>
<div class='col-xs-2'>Country</div>
<div class='col-xs-2'>Confirmed?</div>
</div>
<div ng-repeat="user in users" class='row'>
<div class='col-xs-2'>
<input ng-model="user.user_name" ng-blur="updateUser(user)">
</div>
<div class='col-xs-2'>{{user.user_email}}</div>
<div class='col-xs-2'>{{user.user_company}}</div>
<div class='col-xs-2'>{{user.user_jobtitle}}</div>
<div class='col-xs-2'>{{user.user_country}}</div>
<div class='col-xs-2'>{{user.user_confirmed}}</div>
</div>
The Javascript angular code
angular.module('byListApp', []).constant("listUrl",
"http://elms2.com/list-rest").constant("userUrl",
"http://elms2.com/user-rest").controller(
"ByListCtrl",
function($scope, $http, listUrl, userUrl) {
$scope.hide = true;
$scope.showMessage = false;
$http.get(listUrl + '/' + ownerId).then(function(response) {
$scope.lists = response.data;
}, function(error) {
$scope.error = error;
alert(error);
});
$scope.listUsers = function(list) {
$scope.message = '';
$scope.hide = true;
$scope.showMessage = false;
// $scope.booksFound[0].message = '';
$http.get(userUrl + '/byList:' + list.list_id).then(
function(response) {
$scope.users = response.data;
});
};
});
angular.module('byDomainApp', []).constant("domainUrl",
"http://elms2.com/domain-rest").constant("userUrl",
"http://elms2.com/user-rest").controller(
"ByDomainCtrl",
function($scope, $http, domainUrl, userUrl) {
$scope.hide = true;
$scope.showMessage = false;
$http.get(domainUrl).then(function(response) {
$scope.domains = response.data;
}, function(error) {
$scope.error = error;
alert(error);
});
$scope.domainUsers = function(domain) {
$scope.message = '';
$scope.hide = true;
$scope.showMessage = false;
$http.get(userUrl + '/byDomain:' + domain.domain_id).then(
function(response) {
$scope.users = response.data;
}, function(error) {
$scope.error = error;
alert(error);
});
};
$scope.updateUser = function(user) {
$http.get(userUrl + '/updateUser:' + user).then(
function(response) {
$scope.userData = response.data;
}, function(error) {
$scope.error = error;
alert(error);
});
};
});
The list of domains is generated correctly and the ng-repeat fills with the correct data when a domain is selected. However nothing happens when the input field contents are edited and then loses focus. I can prove that by deleting the updateUser function from the angular code or replacing the ng-blur action with an alert or similar.