Attempting to implement a presenter that is hopefully loosely aware of a <ng-template #templateRef > template reference from the view/component. An example of the mvp can be found here
I have been having difficulty finding a good way to pass the ElementRef. I am attempting to assign the value to a presenter value in ngAfterViewInit() { this.presenter.elementRef = this.elementRef } using @ViewChild, but it does not work as its returning undefined.
Is there a good way to reference a template from a presenter (better if loosely coupled ... looked at Renderer2 but figured this wont work)
Edit:
I got it to work by calling a function that sets the values on ngAfterViewInit() in the component as opposed to a direct setter (the DI of the presenter in the component ctor likely caused the issues), but still think this approach could be improved and loosely coupled -- any thoughts?
Edit 2:
Another option is to remove the need for a template ref entirely by SoC of the two template refs into their own components that are linked by the container
Thanks