how to get root viewContainerRef of angular2 aplication

前端 未结 2 1809
我在风中等你
我在风中等你 2021-01-14 16:18

loadNextToLocation now expects a ViewContainerRef, any ideas on how to get the root viewContainerRef of the application in a correct way?

thanks in advance.

2条回答
  •  天涯浪人
    2021-01-14 16:44

    I haven't tried it with the root component myself yet but I assume it works the same as with other components:

    class AppComponent {
      constructor(private vcRef:ViewContainerRef) {}
    }
    

提交回复
热议问题