Angular Not working a click on table after click into ng-select

515 views Asked by At

I get data from backend and I need show it in table. Data have to be grouped by some attributes, here is the code:

    getRows(data: MyData[]): Array<Array<MyData>> {

    const exceptionsArray: Array<Array<MyData>> = [];

    const exceptions = new Map<string, Array<MyData>>();
    data.forEach(exc => {
        const key = exc.name != null ? exc.name + '_' + exc.id : exc.id;
        const exceptionsArray = exceptions.has(key) ? exceptions.get(key) : new Array<MyData>();
        exceptionsArray.push(exc);
        exceptions.set(key, exceptionsArray);
      }
    );

    exceptions.forEach((value: Array<MyData>) => {
      exceptionsSet.push(value);
    });
    return exceptionsSet;
  }

data is inserted into the table:

<table width="100%">
<thead>..

<ng-container *ngFor="let row of getData(mpnIpn.data)">
      <tr *ngFor="let record of row">
        <td class="small text-muted noBg">&nbsp;</td>
        <ng-container *ngIf="allowManipulate; else emptyCells">
          <td class="noBg">
            <a class="pointer text-nowrap" title="New comment"
               (click)="newComment(record)">New comment</a>
            <span *ngIf="row.length > 1">
              /&nbsp;<a class="pointer text-nowrap" title="Modify records"
                        (click)="modifyRecords(record)">Modify records</a>

            </span>
          </td>
        </ng-container>
        <ng-container #emptyCells>
          <td class="noBg">&nbsp;</td>
        </ng-container>
      </tr>
    </ng-container>
</thead>

When I go first time on page and click on the link, a modal windows is opened (on link is possible click).

But when I go on other page, which contains ng-select and I click in this ng-select and go to back on page with table, on links is not clickable. Mouse is changed but modal windows is not opened. I tried printing to console on clicking, but that's not working either.

When I press F5(refresh page) everything starts working. I am using Angular 5.

Thank you.

EDITED

added stackblitz

When I copy this code in angular version 10 all working well

0

There are 0 answers