How to set maximum length in input type=number?
Try This
var jimApp = angular.module("mainApp", []);
jimApp.controller('mainCtrl', function($scope){
var oldNumber = 0;
$scope.numberChanged = function(number){
if(number<=999){
oldNumber = number;
}
return oldNumber;
};
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="mainApp" ng-controller="mainCtrl">
<input type="number" min="0" max="999" ng-model="jimNum" ng-change="jimNum = numberChanged(jimNum);">
</div>
max
attribue specifies the maximum possible value that we can specify.
for more details see this link
I think the following will be helpful to you,
//maxlength="10"
<input type="number" onKeyPress="if(this.value.length==10) return false;" />