Skip to content

Instantly share code, notes, and snippets.

@natmegs
Created December 20, 2017 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save natmegs/a690781c5e35b8596c16ee48db37497c to your computer and use it in GitHub Desktop.
Save natmegs/a690781c5e35b8596c16ee48db37497c to your computer and use it in GitHub Desktop.
Get reference to ViewContainer
import { Component } from '@angular/core';
import { DynamicComponent } from './dynamic.component';
@Component({
selector: 'host',
templateUrl: './host.component.html',
styleUrls: [ './host.component.css' ],
entryComponents: [DynamicComponent]
})
export class AppComponent {
@ViewChild('container', { read: ViewContainerRef }) container: ViewContainerRef;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment