<input type="email" id="username" dbrans-validate-async="{unique: isUsernameUnique}" ng-model="username" required class="form-control" name="username">
$scope.isUsernameUnique = function(username) {
$http.get(url+'/isUsernameUnique' + username).then(function() {
return $q.reject(); // 200 - user exists
}, function() {
return true; // 404 - user does not exist
});
};
What would be the API to validate a unique username in CakePHP3 using the "users" table in my database? Also, how can I check if the username field is touched but empty or incorrect on form submit? Any help would be appreciated. Thank you.