Skip to content

Instantly share code, notes, and snippets.

@stevermeister
Created March 26, 2017 09:59
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 stevermeister/d1444736b5316584ff5552fa5f77fc56 to your computer and use it in GitHub Desktop.
Save stevermeister/d1444736b5316584ff5552fa5f77fc56 to your computer and use it in GitHub Desktop.
import {Directive, Input, TemplateRef, ViewContainerRef} from '@angular/core';
@Directive({
selector: '[appDelay]'
})
export class DelayDirective {
constructor(
private templateRef: TemplateRef<any>,
private viewContainerRef: ViewContainerRef
) { }
@Input() set appDelay(time: number): void {
setTimeout(()=>{
this.viewContainerRef.createEmbeddedView(this.templateRef);
}, time);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment