mevr
mevr

Reputation: 1125

Toggle table row based on if condition not working

Need to toggle one table row based on if condition not working.

If status id none I need to open a form in popup but if status is done popup shouldn't open.

<ng-container *ngFor="let person of personList | 
        searchFilter:searchValue;index as i">
    <tr *ngIf="person.status == 'none'" 
            data-toggle="modal" data-target="#personModal" 
            (click)="function(person.id)">
        <tr *ngIf="person.status == 'done'" >
            <td>Place</td>
            <td>Job</td>
        </tr>
    </tr>
</ng-container>

When I tried this solution the row is not displaying in the table list

Upvotes: 0

Views: 214

Answers (1)

Probably you should do something like this:

<ng-container *ngFor="let person of personList | searchFilter:searchValue;index as i">
  <tr *ngIf="person.status == 'none'" data-toggle="modal" data-target="#personModal" 
      (click)="someFunction(person.id)">
    <td>Place</td>
    <td>Job</td>
  </tr>
  <tr *ngIf="person.status == 'done'" >
    <td>Place</td>
    <td>Job</td>
  </tr>
</ng-container>

But it's important to see your TypeScript code. You should make a Stackblitz example.

Upvotes: 1

Related Questions