bixi
Version:
企业级中后台前端解决方案
29 lines (24 loc) • 1.01 kB
text/typescript
import { ChangeDetectionStrategy, Component, Input, OnInit, TemplateRef } from '@angular/core';
import { NzSafeAny } from 'ng-zorro-antd/core/types';
import { EBixiCustomTplType, IRow, ITemplateCol } from '../table.type';
import { ColTemplateService } from './col-template.service';
import { ColBase } from './col.base';
({
selector: 'bixi-table-col-template',
host: { '[class.bixi-table-col-template]': 'true' },
template: `
<ng-template [ngTemplateOutlet]="outletRef" [ngTemplateOutletContext]="{$implicit: row, index: index}"></ng-template>
`,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class BixiTableColTemplateComponent extends ColBase implements OnInit {
() row: IRow;
() col: ITemplateCol;
outletRef: TemplateRef<NzSafeAny> | undefined;
constructor(private colTemplateService: ColTemplateService) {
super();
}
ngOnInit() {
this.outletRef = this.colTemplateService.getTemplateRef(this.col.ref, EBixiCustomTplType.body);
}
}