0% found this document useful (0 votes)
3 views1 page

Search Overlay - Service

Uploaded by

Prakash Shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Search Overlay - Service

Uploaded by

Prakash Shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import { Injectable, inject } from '@angular/core';

import { MatDialog, MatDialogRef } from '@angular/material/dialog';


import { SearchOverlayComponent } from './search-overlay.component';

@Injectable({ providedIn: 'root' })


export class SearchOverlayService {
private dialog = inject(MatDialog);
private ref: MatDialogRef<SearchOverlayComponent> | null = null;

open(): void {
if (this.ref) return;
this.ref = this.dialog.open(SearchOverlayComponent, {
autoFocus: false,
restoreFocus: true,
disableClose: true,
panelClass: 'search-overlay-panel',
backdropClass: 'search-overlay-backdrop',
width: '100vw',
maxWidth: '100vw',
height: '100vh',
data: {}
});
this.ref.afterClosed().subscribe(() => (this.ref = null));
}

close(): void { this.ref?.close(); }


}

You might also like