Skip to content

Instantly share code, notes, and snippets.

@cgatian
Created October 24, 2017 01:34
Show Gist options
  • Save cgatian/7d17b1d1dcd5bf9fb35d85ca8fb9db4e to your computer and use it in GitHub Desktop.
Save cgatian/7d17b1d1dcd5bf9fb35d85ca8fb9db4e to your computer and use it in GitHub Desktop.
@Component({
selector: 'app-test',
template: `
<ng-content [cdkPortalHost]="_portalInstance"></ng-content>
<ng-template cdkPortal #cartCount>
<div>Hello World</div>
</ng-template>
`
})
export class TestComponent implements OnInit {
@ViewChild('cartCount') _portalInstance: TemplatePortal<any>;
constructor() { }
ngOnInit() {
this._portalInstance = _portalInstance;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment