Last active
September 2, 2022 20:33
-
-
Save fireflysemantics/5f6385b2b08d673be1cda5571f38882b to your computer and use it in GitHub Desktop.
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
@Directive({ selector: '[isReady]' }) | |
export class ReadyDirective implements OnInit { | |
@Input('isReady') isReady: boolean; | |
constructor( | |
private templateRef: TemplateRef<void>, | |
private vcr: ViewContainerRef | |
) {} | |
ngOnInit() { | |
if (this.isReady) { | |
this.vcr.createEmbeddedView(this.templateRef); | |
} | |
if (!this.isReady) { | |
this.vcr.createComponent(SpinnerComponent); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment