I made a plunker with my problem... https://embed.plnkr.co/UparfJDomOECGJfWSbqA/
Short: I am unable to test my component, it seems to fail in container.component.spec.ts:43
- but without the fixture.detectChanges()
, the ngAfterViewInit
won't be started. I am unable to see what I am doing wrong.
I want to dynamically load a component into an ng-template with a directive attribute and the solution does work, but I am unable to write a working test for it.
Since I am pretty new to unit testing... Is that something I should even test - I think yes. (And yes I read the angular.io testing guide, and some others ;-) )
The error is TypeError: Cannot read property 'viewContainerRef' of undefined
which seems to point that @ViewChild
does not have a ViewChild...