0
<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.

1 Answer 1

1

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.