В дополнение к ответу выше, чтобы установить исходное значение для выбора, вы должны расширить select-custom-trigger-example.ts
в данной демонстрации stackblitz:
import {Component, OnInit} from '@angular/core';
import {FormControl} from '@angular/forms';
/** @title Select with custom trigger text */
@Component({
selector: 'select-custom-trigger-example',
templateUrl: 'select-custom-trigger-example.html',
styleUrls: ['select-custom-trigger-example.css'],
})
export class SelectCustomTriggerExample implements OnInit {
toppings = new FormControl();
toppingList: string[] = ['Extra cheese', 'Mushroom', 'Onion', 'Pepperoni', 'Sausage', 'Tomato'];
ngOnInit()
{
// initalSelection could be the result from a service call (database, backend, etc.):
let initalSelection : string [] = ["Onion","Pepperoni","Sausage"];
// set initalSelection as inital value:
this.toppings.setValue(initalSelection);
}
}