是否可以通过 ng-content 或 TemplateRef 或类似方法来包含自定义列定义?我一直在通过站点(http://www.telerik.com/kendo-angular-ui/components/grid/)提供的 Kendo UI Grid plunker 以及Angular2 子组件作为数据进行测试,但无济于事。我也尝试过 ng-content select 但也没有。非常感谢任何帮助,谢谢!
@Component({
selector: 'test-component',
template:
`
<kendo-grid [data]="Data">
<kendo-grid-column></kendo-grid-column>
// ??? // <ng-content kendo-grid-column></ng-content> // [object Object]
// ??? // <kendo-grid-column ng-content></kendo-grid-column> // [object Object]
</kendo-grid>
`
})
export class TestComponent {
@Input() Data: any;
}
@Component({
selector: 'my-app',
template: `
<test-component [Data]="gridData">
<kendo-grid-column field="ProductID" title="Product ID" width="120"></kendo-grid-column>
<kendo-grid-column field="ProductName" title="Product Name"></kendo-grid-column>
<kendo-grid-column field="UnitPrice" title="Unit Price" width="230"></kendo-grid-column>
<kendo-grid-column field="Discontinued" width="120">
<template kendoCellTemplate let-dataItem>
<input type="checkbox" [checked]="dataItem.Discontinued" disabled/>
</template>
</kendo-grid-column>
</test-component>
`
})
export class AppComponent { ... }