Created
March 26, 2017 09:59
This file contains hidden or 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