1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-04 10:43:47 +00:00
Files
browser/libs/components/src/drawer/drawer-host.directive.ts
Oscar Hinton 26fb7effd3 Remove standalone true from platform and UIF (#15032)
Remove standalone: true from every instance since it's the default as of Angular 19.
2025-06-02 20:03:04 +02:00

28 lines
560 B
TypeScript

import { Portal } from "@angular/cdk/portal";
import { Directive, signal } from "@angular/core";
/**
* Host that renders a drawer
*
* @internal
*/
@Directive({
selector: "[bitDrawerHost]",
})
export class DrawerHostDirective {
private _portal = signal<Portal<unknown> | undefined>(undefined);
/** The portal to display */
portal = this._portal.asReadonly();
open(portal: Portal<unknown>) {
this._portal.set(portal);
}
close(portal: Portal<unknown>) {
if (portal === this.portal()) {
this._portal.set(undefined);
}
}
}