Answer the question
In order to leave comments, you need to log in
How to change one button to another if (click) is already busy?
There is a table from which entries can be saved to the profile, or if saved, you can delete them.
Whether there is a record or not and which button to display is decided when the table is loaded.
And how to make the button change to the opposite one when clicking on the client?
The *ngIf and (click) directives are busy, I can't think of it.
ngx-datatable table column with button:
<ngx-datatable-column
[width]="50"
[resizeable]="false"
[sortable]="false"
[draggable]="false"
[canAutoResize]="false"
>
<ng-template let-row="row" let-rowIndex="rowIndex" let-show="show" ngx-datatable-cell-template>
<div class="go-to-link">
<a class="btn " href="{{row.link}}" target="_blank" title="Перейти к источнику"><i class="fas fa-external-link-alt fa"></i></a>
<button *ngIf="isAddedToProfile(row)==false" class="btn btn-add" (click)="addToProfile(rowIndex)"><i class="far fa-plus-square"></i></button>
<button *ngIf="isAddedToProfile(row)==true" class="btn btn-add" (click)="deleteFromProfile(rowIndex)"><i class="fas fa-minus-square"></i></button>
</div>
</ng-template>
</ngx-datatable-column>
isAddedToProfile(row) {
return this.addedPersons.some(person => person.id === row.id);
}
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