我有基本组件和基本指令:
@Component({
selector: 'datatable',
template: `<ng-content><ng-content>`
})
export class DatatableComponent {
QueryList<DatatableColumn> columns;
}
@Directive({ selector: 'datatable-column' })
export class DatatableColumn { }
现在我想创建扩展的DatatableComponent 相同的功能
@Component({
selector: 'df-datatable',
template: `<ng-content><ng-content>`
})
export class DFDatatableComponent extends DatatableComponent {
QueryList<DFDatatableColumn> columns;
}
@Directive({ selector: 'df-datatable-column' })
export class DFDatatableColumn extends DatatableColumn { }
我的问题是为什么这不起作用?
<df-datatable>
<df-datatable-column>
</df-datatable-column>
</df-datatable>
但这很有效。如何从基类覆盖QueryList?
<df-datatable>
<datatable-column>
</datatable-column>
</df-datatable>