select option in reactive forms

Solutions on MaxInterview for select option in reactive forms by the best coders in the world

showing results for - "select option in reactive forms"
Daniele
10 Oct 2016
1<select class="custom-select" (change)="changeCity($event)" formControlName="cityName">
2   <option value="" disabled>Choose your city</option>
3   <option *ngFor="let city of City" [ngValue]="city">{{city}}</option>
4</select>
Romane
15 Mar 2020
1// City Names
2  City: any = ['Florida', 'South Dakota', 'Tennessee', 'Michigan']
Agustina
02 Apr 2018
1import { Component } from '@angular/core';
2import { FormBuilder, Validators } from "@angular/forms";
3
4@Component({
5  // ...
6})
7
8export class AppComponent {
9
10  constructor(public fb: FormBuilder) { }
11
12  /*########### Form ###########*/
13  registrationForm = this.fb.group({
14    cityName: ['']
15  })
16
17  onSubmit() {
18    alert(JSON.stringify(this.registrationForm.value))
19  }
20
21}