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

Method ngOnDestroy

src/cdk/dialog/dialog.ts:180–199  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

178 }
179
180 ngOnDestroy() {
181 // Make one pass over all the dialogs that need to be untracked, but should not be closed. We
182 // want to stop tracking the open dialog even if it hasn't been closed, because the tracking
183 // determines when `aria-hidden` is removed from elements outside the dialog.
184 reverseForEach(this._openDialogsAtThisLevel, dialog => {
185 // Check for `false` specifically since we want `undefined` to be interpreted as `true`.
186 if (dialog.config.closeOnDestroy === false) {
187 this._removeOpenDialog(dialog, false);
188 }
189 });
190
191 // Make a second pass and close the remaining dialogs. We do this second pass in order to
192 // correctly dispatch the `afterAllClosed` event in case we have a mixed array of dialogs
193 // that should be closed and dialogs that should not.
194 reverseForEach(this._openDialogsAtThisLevel, dialog => dialog.close());
195
196 this._afterAllClosedAtThisLevel.complete();
197 this._afterOpenedAtThisLevel.complete();
198 this._openDialogsAtThisLevel = [];
199 }
200
201 /**
202 * Creates an overlay config from a dialog config.

Callers 1

dialog.spec.tsFile · 0.45

Calls 3

_removeOpenDialogMethod · 0.95
reverseForEachFunction · 0.85
closeMethod · 0.45

Tested by

no test coverage detected