I want to display the items from the "cabinet" array in a dropdown. I've tried the below code, but it's not working. Please help.
Component.ts File:
getProductDetail(id: string) {
const x = this.productService.getProductById(id);
x.snapshotChanges().subscribe(
(product) => {
const y = product.payload.toJSON() as Product;
y.$key = id;
this.cabinet = y['cabinet'];
console.log("Cabinets",this.cabinet);
return this.cabinet;
}
Component.html File
<div>
Select Cabinet
<select
[(ngModel)]="selectedCabinetType"
>
<option *ngFor="let item of cabinet">
{{ item }}
</option>
</select>
</div>