小编Ela*_*n M的帖子

Disable the button when fields are empty in Angular5 [ invalid form ]

I am learning Angular5, new to this.

I have two input fields, one button. Handled validations for that two fields, will enable the button once two fields are entered. I have disable the button when the form is invalid. But it is not working.

<form class="customerRegisteration-form">  
  <div class="form-row">
  <div class="form-group col-md-6">
    <label for="firstName">First Name</label>
      <input required ngModel name="firstName" id="firstName" class="form-control"  placeholder="First Name" #firstName="ngModel"/>
      <div class="alert alert-danger" *ngIf="firstName.touched && !firstName.valid">First Name is required</div>
  </div>
  <div class="form-group col-md-6">
    <label for="lastName">Last Name</label>
    <input …
Run Code Online (Sandbox Code Playgroud)

angular-validation angular

2
推荐指数
1
解决办法
6834
查看次数

标签 统计

angular ×1

angular-validation ×1