yuyang041060120 / ng2-validation

angular2 validation
https://yuyang041060120.github.io/ng2-validation/index.html
MIT License
612 stars 213 forks source link

Bootstrap validation is #134

Open rostamiani opened 4 years ago

rostamiani commented 4 years ago

When using Bootstrap invalid fields are green instead of red. The problem is that the "ng-invalid" class is added to the field but ":valid" is still applied. This is the input field:

<input [(ngModel)]="request.count" type="number" 
class="form-control" name="count" id="count" autocomplete="off" 
[min]="1" [max]="warehouseRequest.count_request" pattern="^\d+$" required>

And this is the generated DOM:

<input _ngcontent-vyd-c6="" autocomplete="off" 
class="form-control ng-touched ng-dirty ng-invalid"
name="count" pattern="^\d+$" required="" type="number" ng-reflect-required="" 
ng-reflect-pattern="^\d+$" ng-reflect-max="10" ng-reflect-min="1" ng-reflect-name="count" 
ng-reflect-model="-5">

And this is the output of checkValidity() function:

image

And the form itself:

image