md-message not working md-maxlength validation
ng-messages along with md-input-container not working for validation pipeline md-maxlength . It should show messages with if validation broke out
I am writing like this
<md-input-container class="md-block" flex-gt-sm > <label>Amount</label> <input name="resRent" ng-pattern="/^[0-9\d,]{1,12}$/" md-maxlength="5" rupees required> <div ng-messages="fromname.resRent.$error" > <div ng-message="required">Please enter amount</div> <div ng-message="pattern">only digits allowed </div> <div ng-message="maxlength" >amount exceeds limit</div> </div> </md-input-container>
It is showing message "Please enter amount" instead of "amount exceeds limit" if i type more than 5 digits in that field .
and validation it is not invoked if i exceeds the limit of digit .
Angular Versions: * "angular": "^1.4.0", "angular-material": "^1.1.0", "angular-messages": "@1.4.0"
The validator is md-maxlength and not maxlength. reference: Example code: https://github.com/angular/material/blob/7e211188ae33171d527921a59e001fa9e311394d/src/components/input/input.js#L236 Validator code: https://github.com/angular/material/blob/7e211188ae33171d527921a59e001fa9e311394d/src/components/input/input.js#L654
@goelprateek Please update your code according to @saibs's recommendation. If that still does not work, please provide a Codepen demo (rather than just adding the code to the issue) so that we can test and investigate further.
No demo provided. Assuming recommendation worked.