I'm using Angular 8 Form Module for form validation. My problem is that "min" validation rule does not apply when validation. This is my sample form:
html:
<form #form="ngForm" (ngSubmit)="form.valid && submit()">
<input type="number" min="5" required name="count" [(ngModel)]="count">
<button>submit</button>
<br><br>
Submitted value is : {{submittedValue || "Nothing yet..."}}
</form>
TS:
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
})
export class AppComponent {
count = -5;
submittedValue :number;
submit(){
console.log(this.count);
this.submittedValue = this.count;
}
}
You can test run code here: https://angular-html-validation-test.stackblitz.io