answer:
dont use exportAs
use @ViewChild('myContent') myContent; to get the instance of the parent class
it will only work if the view is initialized, so better use ngAfterViewInit
this concerns inheritance !
base class (component)
|
inherited class (component)
I have a base class component exported with exportAs
@Component({
selector: 'my-content',
exportAs: 'myContent',
...
})
the inherited class component uses a reference to the base class template in its own template
<my-content #myContent>
...
in the inherited component's code I try to get its instance
@ViewChild('myContent') myContent;
or
@ContentChild('myContent') myContent;
some say this should work but myContent is alway undefined
how do I solve this ?
thanks