MCPcopy Create free account
hub / github.com/angular/components / constructor

Method constructor

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

Source from the content-addressed store, hash-verified

832 private _injector = inject(Injector);
833
834 constructor() {
835 const platform = inject(Platform);
836 const viewportRuler = inject(ViewportRuler);
837
838 // If a `Dir` directive exists up the tree, listen direction changes
839 // and update the left/right properties to point to the proper start/end.
840 this._dir?.change.pipe(takeUntil(this._destroyed)).subscribe(() => {
841 this._validateDrawers();
842 this.updateContentMargins();
843 });
844
845 // Since the minimum width of the sidenav depends on the viewport width,
846 // we need to recompute the margins if the viewport changes.
847 viewportRuler
848 .change()
849 .pipe(takeUntil(this._destroyed))
850 .subscribe(() => this.updateContentMargins());
851
852 if (!this._animationDisabled && platform.isBrowser) {
853 this._ngZone.runOutsideAngular(() => {
854 // Enable the animations after a delay in order to skip
855 // the initial transition if a drawer is open by default.
856 setTimeout(() => {
857 this._element.nativeElement.classList.add('mat-drawer-transition');
858 this._transitionsEnabled = true;
859 }, 200);
860 });
861 }
862 }
863
864 ngAfterContentInit() {
865 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