validator-gui/src/app/directives/logged-in.ts

18 lines
419 B
TypeScript

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