MCPcopy Index your code
hub / github.com/angular/angular / destroy

Method destroy

packages/core/src/platform/platform_ref.ts:123–140  ·  view source on GitHub ↗

* Destroys the current Angular platform and all Angular applications on the page. * Destroys all modules and listeners registered with the platform.

()

Source from the content-addressed store, hash-verified

121 * Destroys all modules and listeners registered with the platform.
122 */
123 destroy() {
124 if (this._destroyed) {
125 throw new RuntimeError(
126 RuntimeErrorCode.PLATFORM_ALREADY_DESTROYED,
127 ngDevMode && 'The platform has already been destroyed!',
128 );
129 }
130 this._modules.slice().forEach((module) => module.destroy());
131 this._destroyListeners.forEach((listener) => listener());
132
133 const destroyListeners = this._injector.get(PLATFORM_DESTROY_LISTENERS, null);
134 if (destroyListeners) {
135 destroyListeners.forEach((listener) => listener());
136 destroyListeners.clear();
137 }
138
139 this._destroyed = true;
140 }
141
142 /**
143 * Indicates whether this instance was destroyed.

Callers

nothing calls this directly

Calls 5

destroyMethod · 0.65
getMethod · 0.65
listenerFunction · 0.50
forEachMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected