I'm using the DynamicComponentLoader to load a component dynamically, which is passed by a parameter. I'd like to use the old loadIntoLocation method, but that has been removed as of beta16 (I'm using RC0).
In the end I would like to be able to load a component inside the #activeComponent div while still being able to toggle a parents visibility, like so:
<div *ngIf="isOpen>
  <div #activeComponent></div>
</div>
This is what I got:
@Input() activeComponent: any;
constructor(){}
ngOnChanges() {
  this._dynamicComponentLoader.loadNextToLocation(this.activeComponent, this._viewContainerRef);
}
And this works, but, as the method's name implies, the component is loaded next to location, as a sibling. I would like a child, like the old loadIntoLocation method.
The Angular 2 beta16 changelog writes: Use @ViewChild(‘myVar’, read: ViewContainerRef) to get hold of a ViewContainerRef at an element with variable myVar. Then call DynamicComponentLoader.loadNextToLocation.
This is what I would like to work:
@ViewChild('activeComponent',) child: ViewContainerRef;
constructor(){}
ngOnChanges() {
    if (!this.activeComponent) return;
    this._dynamicComponentLoader.loadNextToLocation(this.activeComponent, this.child);
}
But I'm getting : TypeError: location.createComponent is not a function.
Anyone who got the _dynamicComponentLoader with @ViewChild working?
 
     
    