How to populate dropdown from a json file?

  angular, angular-ui-bootstrap

json file has…

"OrderTypeList": [
  "id": 1,
  "orderType": "XYZ"


component code:

  orderTypes: any[];

  getOrderTypes() { 
   this.OrderService.getJsonData('./assets/OrderTypes.json').subscribe((data:any[]) => {
        this.orderTypes = data;

The drop-down component shows the entire json object in one line?! I only want order types.

<select name="types" id="#" *ngFor="let ot of orderTypes | keyvalue">
    <option selected="selected" value="one">{{ot.value | json}}</option>

Source: Angular Questions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.