完整的 ng11=](排序、搜索)不起作用 angular 10

full ng-table (sorting, search) not workink angular 10

我正在尝试使用 the full ng-table,但它不适用于 angular 10.

当我尝试复制粘贴代码时,此处出现错误

@Directive({
 selector: 'th[mzSortable]',
 host: {
 '[class.asc]': 'direction === "asc"',
 '[class.desc]': 'direction === "desc"',
 '(click)': 'rotate()'
 }
})

我试着用这个...

@Input() sortable: SortColumn = '';

@Input()
direction: SortDirection = '';

@Input()
@HostBinding('class.asc')
get ascClass (): any {
 return this.direction === 'asc';
}

@Input()
@HostBinding('class.desc')
get descClass (): any {
  return this.direction === 'desc';
}

@Output() sort = new EventEmitter<SortEvent>();

@HostListener('click')
rotate(): void {
  this.direction = rotate[this.direction];
  this.sort.emit({column: this.sortable, direction: this.direction});
}

现在 table 出现了,但我无法对 table

进行排序

我找到了,问题是我更改了指令前缀。 替换为:

@Directive({
  selector: 'th[mzSortable]',
} 
})

通过这个:

@Directive({
  selector: 'th[sortable]',
} 
})