1
Ich benutze eckige 2 formbuilder um ein Formular zu erstellen. Ich möchte nur positive Werte in das Betragsfeld eingeben (minValue ist 0 und maxvalue ist 100) Wie kann ich die min und max Validierung mit angular2 Formbuilder durchführen?winkel 2 formbauer min max validation
Html-Code
<form class="form-horizontal"
novalidate
(ngSubmit)="splitCharges()"
[formGroup]="splitChargeForm" >
<input type="number" id="sequenceId" placeholder="Amount" formControlName="amount" >
</form>
Winkelkomponente
constructor(private fb: FormBuilder){}
ngOnInit() {
this.splitChargeForm = this.fb.group({
amount: ['', Validators.required], // want to set min=0 and max=100 validations for this field
percentage: ['', Validators.required]
});
}
@KetanAkbari 'minLength' und' maxLength' ist nicht die Frage, so weit ich es verstehe. –
ok greate, es hilft mir. Vielen Dank –