bixi
Version:
企业级中后台前端解决方案
29 lines (23 loc) • 1.03 kB
text/typescript
import { ChangeDetectionStrategy, Component, Input, OnInit, TemplateRef } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { NzSafeAny } from 'ng-zorro-antd/core/types/any';
import { IEditableRow, IEditableTemplateCol } from './editable-table.type';
import { EditableTemplateService } from './editable-template.service';
({
selector: 'editable-col-template',
host: { '[class.editable-col-template]': 'true' },
template: `
<ng-template [ngTemplateOutlet]="outletRef" [ngTemplateOutletContext]="{$implicit: row, formGroup: formGroup}"></ng-template>
`,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class BixiEditableTemplateComponent implements OnInit {
() row: IEditableRow;
() col: IEditableTemplateCol;
() formGroup: FormGroup;
outletRef: TemplateRef<NzSafeAny> | undefined;
constructor(private templateService: EditableTemplateService) { }
ngOnInit() {
this.outletRef = this.templateService.getTemplateRef(this.col.ref);
}
}