components
components copied to clipboard
feat(bottom-sheet): Access container instance elementRef
Which @angular/* package(s) are relevant/related to the feature request?
@angular/material/bottom-sheet
Description
Consider this service:
....
@Injectable({
providedIn: 'root',
})
export class MyBottomSheetService {
private bottomSheet = inject(MatBottomSheet);
private bottomSheetRef?: MatBottomSheetRef;
open(templateRef: TemplateRef<unknown>): void {
this.bottomSheetRef = this.bottomSheet.open(templateRef);
}
}
This service opens bottom sheets with dynamic content using the given template.
Once it's opened, we want to access to mat bottom sheet container or its DOM content using the bottomSheetRef
in order to execute a generic behavior based in the projected content.
Proposed solution
bottomSheetRef
returned by the open()
method gives access to containerInstance
property.
Convert elementRef
of containerInstance
from private to public property.
Alternatives considered
No alternatives considered...