Last active
October 9, 2021 19:47
-
-
Save ssougnez/398dfe25424f705a78ae5f2fbeeb0216 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
AfterViewInit, | |
Component, | |
ComponentFactoryResolver, | |
Input, | |
ViewChild, | |
ViewContainerRef, | |
} from '@angular/core'; | |
import { HistoryEntry } from './history-entry.model'; | |
@Component({ | |
selector: 'generic-history-entry', | |
template: `<ng-template #host></ng-template>`, | |
}) | |
export class GenericHistoryEntryComponent implements AfterViewInit { | |
@Input() | |
public entry: HistoryEntry; | |
@ViewChild('host', { read: ViewContainerRef }) | |
public hostRef: ViewContainerRef; | |
constructor(private _cfr: ComponentFactoryResolver) {} | |
public ngAfterViewInit() { | |
// Instantiate the correct component based on this.entry.type | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment