jeudi 15 juillet 2021

Nested Condition in *ngIf using ng-container

I am working on requirements where I need to show the list of rows based on some conditions. There is a table cell(td) whose value should be populated based on some condition. I want the following to achieve in angular using *ngIf

 if(value1||values2)
{
if(value3!=null && value4==null)
 {
    //display value 3
 }
 else
 {
 //display value 4
  }
 }
 else
 {
//display default value
 }

I tried this using *ngIf but getting an error **Bidings cannot contain assignments **

  <ng-container *ngIf="(value1 || value2); else showDefault">
   <ng-container *ngIf="value3!=null && value4==null; else showValue4">
    </ng-container>
<ng-template #showValue4>
 </ng-template>
</ng-container>
  <ng-template #showDefault>
 </ng-template>

Is there any other way to achieve this?

Aucun commentaire:

Enregistrer un commentaire