UNPKG

bixi

Version:

企业级中后台前端解决方案

29 lines (23 loc) 1.03 kB
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'; @Component({ 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 { @Input() row: IEditableRow; @Input() col: IEditableTemplateCol; @Input() formGroup: FormGroup; outletRef: TemplateRef<NzSafeAny> | undefined; constructor(private templateService: EditableTemplateService) { } ngOnInit() { this.outletRef = this.templateService.getTemplateRef(this.col.ref); } }