Я попробовал это. Неудачно. Обновил пример также
ользую библиотеку, которая ожидает от меня указания тела директивы как потомкаtemplate
элемент
<template customDirective>
<custom-element #lookup></custom-element>
</template>
Есть ли способ доступаcustom-element#lookup
внутри моего компонента.
Например,
@Component({
selector: 'app-test',
template: `
<template customDirective>
<custom-element #lookup></custom-element>
</template>
`
})
export class TestComponent {
@ViewChild('lookup') viewChildRef;
@ContentChild('lookup') contentChildRef;
constructor() {
}
ngAfterContentInit(): void {
console.log(this.viewChildRef); // <-- undefined
console.log(this.contentChildRef); // <-- undefined
}
}
я собираюсьundefined
в обоих случаях.