Dropdown

HTML

<div class="form-group">
    <label for="contactMethod">
        Contact Method
    </label>
    <select 
    ngModel name="contactMethod" 
    id="contactMethod" 
    class="form-control">
        <option value=""></option>
        <option 
        *ngFor="let method of contactMethods"
        [ngValue]="method">
            {{method.name}}
        </option>
    </select>
</div>

TS

export class ContactFormComponent {
  contactMethods = [
    { id: 1, name: 'Email'},
    { id: 2, name: 'Phone'},
  ];

Full Snippet

Was this page helpful?