簡體   English   中英

如何顯示輸入多選的值 Angular ngFor

[英]How to show the value of input multi selected Angular ngFor

嗨,我在 Angular 工作,我想在控制台中顯示它的值

這是我的 object:

tipos = [
    {
      types: 'HEXO',
      descrip: 'Hora extra',
    },
    {
      types: 'HEXN',
      descrip: 'Hora extra Nocturna',
    }]

<select id="opciones" name="opciones">
    <option  disbled>Select</option>
    <option  *ngFor="let tipo of tipos; let i = index;"  value={{tipo['types']}}>{{tipo['descrip']}}</option>
  </select>

{{tipo['descrip']}} 正在工作,但值 (value={{tipo['types']} ) 向我拋出一個錯誤,我不知道如何迭代以查看控制台中的值。 謝謝!

這是你的意思嗎?

  tipos = [
    {
      types: 'HEXO',
      descrip: 'Hora extra',
    },
    {
      types: 'HEXN',
      descrip: 'Hora extra Nocturna',
    }
  ];

<select id="opciones" name="opciones">
  <option disabled>Select</option>
  <option *ngFor="let tipo of tipos" value="{{tipo.types}}}">{{tipo.descrip}}</option>
</select>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM