Answer the question
In order to leave comments, you need to log in
How to check if an object has options and display them?
rielt: Object = {
buy: {
name: 'Купить',
thing: {
room: {
name: 'Room',
options: {
new: {
name: 'NewHome'
},
secondhend: {
name: 'SecondHend'
}
}
},
home: {
name: 'Home'
}
}
},
};
<mat-form-field>
<mat-select [(ngModel)]="selected">
<mat-option *ngFor="let n of rielt | keyvalue" [value]="n.key">
{{ n.value.name }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="selected">
<mat-select>
<mat-option *ngFor="let n of rielt[selected].thing | keyvalue" [value]="n.key">
{{ n.value.name }}
</mat-option>
</mat-select>
</mat-form-field>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question