below is the code snippet for angular reactive form field. The button stays disable until I valid input in mobile field but the same doesn't work for text field. I want second input text field to be disabled until I enter a valid input to mobile field.
<div id="mobile_verification">
<input class="form-control" id="mobile" formControlName="mobile" placeholder="Mobile no." maxlength="10">
<input class="form-control" id="otp" [disabled]= "!contactForm.controls['mobile'].valid" formControlName="otp" placeholder="OTP" maxlength="6">
<button type="submit" [disabled]="!contactForm.controls['otp'].valid" class="btn btn-success">Verify</button>
<button type="submit" [disabled]="!contactForm.controls['mobile'].valid" class="btn btn-success">Resend</button>
</div>
Is there any another way for text field or am I missing anything? Any help is appreciated.
Thanks.
[disabled]
doesn't work with reactive forms on form controls, you need to "manually" disable/enable – AJT82formControlName
notation does it? So no, buttons are not a form controls :) – AJT82