Reputation: 1207
<div class="col-md-3 col-sm-4">
<div class="ui-input-group">
<select #categoryVal="ngModel" class="form-control" name="staffCategory" [(ngModel)]="staffCategory">
<option value=null >--Select--</option>
<option *ngFor="let cat of applicationCategories" value="{{cat.categoryCode}}">{{cat.categoryName}}</option>
</select>
<span class="input-bar"></span>
<label class="control-label">Category<span style="color:#f44336;">*</span></label>
</div>
<button class="btn btn-primary btn-sm ripple" [disabled]="categoryVal.errors" name="searchPerson" (click)="searchNewPerson($event)">Search</button>
</div>
Here if value of select box is <option value=null >--Select--</option>
then need to disable the search and give a tool tip(default form authentication 'Pleas fill the fields') by highlighting that field.
THe above code is not working as expected.
Upvotes: 0
Views: 34
Reputation: 954
For Button Disabling Set value to to empty when --Select--
<option value="">--Select--</option>
and in your button:
<button class="btn btn-primary btn-sm ripple" [disabled]="categoryVal==''" name="searchPerson" (click)="searchNewPerson($event)">Search</button>
Upvotes: 1