How to extract ViewContainerRef and ComponentRef in most efficient way?

Viewed 3859

I work with angular-material mdSidenav and want to programmatically open it and insert custom component.

I use @ViewChild('varName') to extract componentInstance and @ViewChild('varName', {read: ViewContainerRef}) to extract container where I would place my content.

So, my question is - is it possible just 1 @ViewChild and get other info from extracted reference.

Second question - which values allowed for read property ? ElementRef/ViewContainerRef/... ?

Update:

I found, that ViewContainerRef of mdSidenav incorrect container for my component. How to place component.hostView inside mdSidenav hostView?

1 Answers
Related