ng-vdom
ng-vdom copied to clipboard
Feature: pipe to covert TemplateRef to function component
API Design
@Component({
template: `
<ng-template #dateCell let-date="date">{{ date | date:'yyyyMMdd' }}</ng-template>
<bridged-comp [renderProp]="dateCell | renderable"></bridge-comp>
`
})
class MyComp {}
Corresponding util function:
import { asRenderable, Renderable } from 'ng-render'
@Component({
template: `
<ng-template #dateCell let-date="date">{{ date | date:'yyyyMMdd' }}</ng-template>
`
})
class MyComp extends Renderable {
@ViewChild('dateCell') dateCell: TemplateRef<{ date: Date }>
render() {
return (
<SomeComp renderProp={asRenderable(this.dateCell)}>
)
}
}