Angular ngFor with ngIf usage

<tbody *ngIf='serviceResponse.veichleModels'>
        <tr *ngFor="let veichle of serviceResponse.veichleModels">
            <ng-container *ngIf="veichle.veichleModel == selected">
                <td>{{veichle.property1}}</td>
                <td>{{veichle.property2}}</td>
                <td>{{veichle.property3}}</td>
            </ng-container>
        </tr>
</tbody>
export class AppComponent  {
  selected = 'M1';
  serviceResponse = {"veichleModels": [{
            "veichleModel": "M3",
            "property1": "M3val1",
            "property2": "M3val2",
            "property3": "M3val3"
        },
        {
            "veichleModel": "M1",
            "property1": "M1val1",
            "property2": "M1val2",
            "property3": "M1val3"
        }
    ]}
}

Add Comment