Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
[[ng][directives]] OneTimeDirective #ng #directive
selector: '[oneTime]',
export class OneTimeDirective {
constructor(template: TemplateRef<any>, container: ViewContainerRef, zone: NgZone) {
zone.runOutsideAngular(() => {
const view = container.createEmbeddedView(template);
setTimeout(() => view.detach());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment