MCPcopy
hub / github.com/angular/components / constructor

Method constructor

src/material/sidenav/drawer.ts:814–842  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

812 private _injector = inject(Injector);
813
814 constructor() {
815 const platform = inject(Platform);
816 const viewportRuler = inject(ViewportRuler);
817
818 // If a `Dir` directive exists up the tree, listen direction changes
819 // and update the left/right properties to point to the proper start/end.
820 this._dir?.change.pipe(takeUntil(this._destroyed)).subscribe(() => {
821 this._validateDrawers();
822 this.updateContentMargins();
823 });
824
825 // Since the minimum width of the sidenav depends on the viewport width,
826 // we need to recompute the margins if the viewport changes.
827 viewportRuler
828 .change()
829 .pipe(takeUntil(this._destroyed))
830 .subscribe(() => this.updateContentMargins());
831
832 if (!this._animationDisabled && platform.isBrowser) {
833 this._ngZone.runOutsideAngular(() => {
834 // Enable the animations after a delay in order to skip
835 // the initial transition if a drawer is open by default.
836 setTimeout(() => {
837 this._element.nativeElement.classList.add('mat-drawer-transition');
838 this._transitionsEnabled = true;
839 }, 200);
840 });
841 }
842 }
843
844 ngAfterContentInit() {
845 this._allDrawers.changes

Callers

nothing calls this directly

Calls 4

_validateDrawersMethod · 0.95
updateContentMarginsMethod · 0.95
changeMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected