私は文字列のリストから単純なドロップダウンを表示しています。私はそれを持っていなくても、空のドロップダウンオプションはいつも持っています。画像私はいつもドロップダウンで空の値を持っています
//predefined values for brandingSpaceType
private brandingSpaceTypeValues: string[] = ["Mobile Shop", "Supermarket",
"Shop In Shop", "Shop On Wheel", "Kiosk", "Others"]
private selectedBrandingSpaceType: string = this.brandingSpaceTypeValues[2];
そして、ここに示されているように、HTML
<div class="field">
<select class="form-control" [(ngModel)]="selectUndefinedOptionValue"
name="brandingSpaceType" [disabled]="brandingSpaceTypeStatus.readonly">
<option [selected]="selectedBrandingSpaceType == x" *ngFor="let x of
brandingSpaceTypeValues" [value]="x">{{x}}<option>
</select>{{selectUndefinedOptionValue}}
</div>
パーフェクト。それがどれくらいの時間を無駄にしたのかは分かりません。 –