import { Directive, TemplateRef, ViewContainerRef } from '@angular/core'; import { AuthenticationService } from '../services/authentication'; @Directive({ selector: '[loggedIn]', standalone: true }) export class LoggedInDirective { constructor( tpl: TemplateRef, vcr: ViewContainerRef, auth: AuthenticationService ) { if (auth.isLoggedIn()) { vcr.createEmbeddedView(tpl); } } }