How to use ngFor and ng-select together

as shown in the picture, I want to achieve a font selection effect, and the font data is obtained from the background. I used ngFor loop display, but I need to use ng-selected to select fonts. I don"t know how to use ngFor to combine ng-selected. The code is as follows

<select id="fontstyle" name="fontstyle" class="selectpicker"(change)="setFont($event.target.value);">
   <option *ngFor="let item of dto.fontStyles" [value]="item.font">{{item.name}}</option>
</select>

it is not clear how to implement ng-selected. Please consult the platform god

.
May.27,2022

if you want to get the selected option value, add a bi-directional binding variable in select : [(ngModel)] = "selectedFont" , angular does not use the previous generation ng-select usage, selectedFont is your own defined variable to store fonts, and then you can use it to do something else.

Menu