Created
March 26, 2017 09:59
-
-
Save stevermeister/d1444736b5316584ff5552fa5f77fc56 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 {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