Issue with ng-maxlength, input type='text' and value of type number #8792
Description
In one of my projects, I have an input to hold a maximum number of users. It can contain a maximum of 6 character also.
So I added an input as shown below
input type="text" class="form-control" id="usercount" name="usercount" ng-model="organization.MaxNoOfUsers" maxlength="6"
The model is fetched from an API which will return the value as integer like MaxNoOfUser = 45.
In the controller, this is done with code similar to $scope.organization = { MaxNoOfUsers : 45}.
When this assignment was done, the input validation was failing with 'invalid-maxlength'.
After spending some time on it, I tried to alter the model type to string in the controller with some code as below
var noofUsers = " " + data.MaxNoOfUsers + " ";
$scope.organization = { MaxNoOfUsers : noofUsers }.
This code resolved the issue and the input is no more shows invalid-maxlength.