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

Method constructor

src/dev-app/dialog/dialog-demo.ts:93–108  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91 readonly cdr = inject(ChangeDetectorRef);
92
93 constructor() {
94 const dialog = this.dialog;
95 const doc = inject(DOCUMENT);
96
97 // Possible useful example for the open and closeAll events.
98 // Adding a class to the body if a dialog opens and
99 // removing it after all open dialogs are closed
100 dialog.afterOpened.subscribe(() => {
101 if (!doc.body.classList.contains('no-scroll')) {
102 doc.body.classList.add('no-scroll');
103 }
104 });
105 dialog.afterAllClosed.subscribe(() => {
106 doc.body.classList.remove('no-scroll');
107 });
108 }
109
110 openJazz() {
111 this.dialogRef = this.dialog.open(JazzDialog, this._getDialogConfig());

Callers

nothing calls this directly

Calls 2

removeMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected