Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
I have form like below
<h1>Add user</h1>
<form #f="ngForm"
      novalidate
      (ngSubmit)="onSave(f.value)">
  <input
      type="text"
      name="name"
      [(ngModel)]="user.name"
      #name="ngModel"
      required="required"
      minlength="5">

    <span [hidden]="name.valid || (name.pristine && !f.submitted)" class="text-danger">
          Name is required (minimum 5 characters).
        </span>
     <select  name="application_name" [(ngModel)]="ProductName" (ngModelChange)="onSelectApplication()" required #ProductName="ngModel">
                              <option value="" infor-translate="select_application_name"></option>
                              <option *ngFor="let item of ProductName" [ngValue]="item">{{item.ProductName}}</option>
                          </select>
   <button type="submit" class="btn btn-default">Submit</button>
</form>


Could you please tell me that how to give error message for dropdown box

What I have tried:

I have tried
<span class="errorMessage" 
                              [hidden]="ProductName.selectedValue=='select_application_name' || (ProductName.pristine && !addAvailableApis.submitted)">
                            Required
                        </span>
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900