gpt4 book ai didi

选择的 Angular4 占位符

转载 作者:太空狗 更新时间:2023-10-29 17:04:04 28 4
gpt4 key购买 nike

我正在尝试向 Angular 4 上的选择添加占位符,但无法使其正常工作,

这是我的代码:

<select name="edit" [(ngModel)]="edit">
<option [ngValue]="null" disabled [selected]="true"> Please select one option </option>
<option *ngFor="let select of list" [ngValue]="edit"> {{ select }}</option>
</select>


export class AppComponent {
list: any[] = ['1', '2', '3'];
edit: any;
}

最佳答案

我创建了 plunker .希望这会有所帮助。

 <select name="edit" [(ngModel)]="edit">
<option [ngValue]="undefined" disabled selected> Please select one option </option>
<option *ngFor="let select of list" [ngValue]="edit"> {{ select }}</option>
</select>
export class AppComponent {
list: any[] = ['1', '2', '3'];
edit: any;
}

关于选择的 Angular4 占位符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46161007/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com