Skip to content

Instantly share code, notes, and snippets.

@Mayankgupta688
Last active September 17, 2020 09:02
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 Mayankgupta688/8de94f640a31e26f8e4d36086bec42ac to your computer and use it in GitHub Desktop.
Save Mayankgupta688/8de94f640a31e26f8e4d36086bec42ac to your computer and use it in GitHub Desktop.
@Directive({
selector: '[delayRendering]'
})
export class DelayRenderingDirective {
constructor(
private template: TemplateRef<any>,
private container: ViewContainerRef
) { }
@Input()
set delayRendering(delayTime: number): void { }
ngOnInit() {
setTimeout(() => {
this.container.createEmbeddedView(this.template);
}, this.delayRendering);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment