【问题标题】:Select box not showing selected values in angular 10 but showing in angular 8 with same code选择框未在角度 10 中显示选定值,但在角度 8 中显示具有相同代码
【发布时间】:2020-11-04 16:27:47
【问题描述】:

我在 Angular 8 和 10 开发的两个不同应用程序中有以下代码,它没有在 Angular 10 应用程序中显示选定的值,但在 Angular 8 应用程序中正确显示

<select [value]="10">
 <ng-container *ngFor="let hour of hours">
  <option [value]="hour">{{hour}}</option>
 </ng-container>
</select>

这里 hours 是一个数组。

【问题讨论】:

    标签: angular angular10


    【解决方案1】:
    I've cross checked this code 
    " <select [value]="10">
     <ng-container *ngFor="let hour of hours">
      <option [value]="hour">{{hour}}</option>
     </ng-container>
    </select> "
    
    It is working on both Angular 8 as well as on Angular 10. On both of the version by dedault it is showing the first element of array is selected.
    

    【讨论】:

      猜你喜欢
      • 2020-07-10
      • 2018-02-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多