title: How do I populate a select options in a form in Angular
body: <p>I have a form with many select options. I need to populate these. Initially via JSON, but later I will populate from my database.</p>
  
  <p>How do I go about this.</p>
  
  <p>This will be my html.</p>
  
  <pre><code>&lt;div class="container mt-4"&gt;
    &lt;div class="card"&gt;
      &lt;form&gt;
          &lt;div class="card-header"&gt;Search for a Property&lt;/div&gt;
          &lt;div class="card-body"&gt;
  
            &lt;!-- County and Town Label--&gt;
            &lt;div class="row"&gt;
              &lt;div class="col-md-6"&gt;
                &lt;label class="ml-1" for="county"&gt;County&lt;/label&gt;
              &lt;/div&gt;
              &lt;div class="col-md-6"&gt;
                &lt;label for="town"&gt;Town&lt;/label&gt;
              &lt;/div&gt;
            &lt;/div&gt;
  
            &lt;div class="row"&gt;
              &lt;!-- County Column --&gt;
              &lt;div class="col-md-6"&gt;
                &lt;select class ="form-control" id="county" name="county"&gt;
                &lt;/select&gt;
              &lt;/div&gt;
              &lt;div class="col-md-6"&gt;
                &lt;select class="form-control" name="town"&gt;
                &lt;/select&gt;
              &lt;/div&gt;
            &lt;/div&gt;
  
          &lt;/div&gt;
      &lt;/form&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This will be my js.</p>
  
  <p>Is there a way to just populate arrays for each select I need and loop through each item.</p>
  
  <pre><code>export class PropertySearchComponent implements OnInit {
  
    searchForm: FormGroup;
  
    constructor(private advertService: AdvertService, private alertify: AlertifyService, private formBuilder: FormBuilder) { }
  
    ngOnInit() {
      this.createSearchForm();
    }
  
    createSearchForm() {
      this.searchForm = this.formBuilder.group({
        town: [, Validators.required],
        county: [, Validators.required],
      });
    }
  }
  </code></pre>