@studiohyperdrive/ngx-auth
Version:
A library of core authentication functionality used with @studiohyperdrive/types-auth.
45 lines (44 loc) • 1.79 kB
TypeScript
import { OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core';
import { NgxAuthenticationAbstractService } from '../../abstracts';
import * as i0 from "@angular/core";
/**
* * A directive that will render a part of the template based on whether the user is authenticated.
*
* Based upon `*ngIf`. See https://github.com/angular/angular/blob/master/packages/common/src/directives/ng_if.ts
*/
export declare class NgxIsAuthenticatedDirective implements OnDestroy {
private readonly authenticationService;
private viewContainer;
/**
* The destroyed state of the directive
*/
private destroyed$;
/**
* The needed templateRefs
*/
private thenTemplateRef;
private thenViewRef;
private elseTemplateRef;
private elseViewRef;
/**
* Whether the user has to be authenticated
*/
private shouldBeAuthenticated;
constructor(authenticationService: NgxAuthenticationAbstractService, templateRef: TemplateRef<any>, viewContainer: ViewContainerRef);
/**
* Whether the user has to be authenticated
*/
set ngxIsAuthenticated(authenticated: boolean);
/**
* The else template in case the condition is not matched
*/
set ngxIsAuthenticatedElse(ngTemplate: TemplateRef<any>);
ngOnDestroy(): void;
private updateView;
/**
* Dispose the current subscription
*/
private dispose;
static ɵfac: i0.ɵɵFactoryDeclaration<NgxIsAuthenticatedDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<NgxIsAuthenticatedDirective, "[ngxIsAuthenticated]", never, { "ngxIsAuthenticated": { "alias": "ngxIsAuthenticated"; "required": false; }; "ngxIsAuthenticatedElse": { "alias": "ngxIsAuthenticatedElse"; "required": false; }; }, {}, never, never, true, never>;
}