I\'m trying to get the value of a mobile number textbox to validate its input value using angular.js. I\'m a newbie in using angular.js and not so sure how to implement thos
ngKeypress, ngKeydown and ngKeyup are now part of AngularJS.
Read more here:
https://docs.angularjs.org/api/ng/directive/ngKeypress https://docs.angularjs.org/api/ng/directive/ngKeydown https://docs.angularjs.org/api/ng/directive/ngKeyup
Earlier solutions:
Solution 1: Use ng-change with ng-model
JS:
function RegisterDataController($scope) {
$scope.keydown = function() {
/* validate $scope.mobileNumber here*/
};
}
Solution 2. Use $watch
JS:
$scope.$watch("mobileNumber", function(newValue, oldValue) {
/* change noticed */
});