Answers for "how do i add selected to an option inside a ngFor loop"

0

select with ngFor on option and ul

<div>
    <ul *ngFor="let sentence of sentences;let i = index;" class="collection">
        <li class="collection-item">
            <p [ngClass]="{'red': sentence?.disco == 1 , 'green': sentence?.disco == 2 }">{{sentence.viewValue}} </p>
            <p style="margin-left:20px; font-size:12px!important">
                <select #val (change)="onChange(val.value,i)">
            <option *ngFor="let cat of foods" [value]="cat.value" >
            {{cat.viewValue}}
            </option>
            </select>
         </p>
      </li>
   </ul>
</div>
Posted by: Guest on May-29-2020

Code answers related to "how do i add selected to an option inside a ngFor loop"

Code answers related to "Javascript"

Browse Popular Code Answers by Language