How to change parameter within the Observable method and receive value according to value obtained on click
orderItem(item: string, value: string) {
switch (value) {
case 'status':
this._sortService.listSort(this._sortService.filter, { sort: {
"colaborator.status": 1 } }).subscribe(res => {
this.dataSource = res.data;
}, err => {
console.info('### ERRO sort', err);
});
break;
default:
}
}
Exemple value: Status and name
<ng-container>
<th headerCell column="status"
(click)="OrderItem($event, 'status')">
Status</th>
<td *cell="let element" (click)="open()">
{{element.colaborator.status)}}
</td>
</ng-container>
<ng-container>
<th *headerCell column="name"
(click)="orderItem($event, 'name')">Name</th>
<td>
{{ element.name }}
</td>
</ng-container>
I wish I didn’t have to duplicate the Subscribe method: this._sortService.listSort