MCPcopy Create free account
hub / github.com/angular/angular / destroy

Method destroy

packages/core/src/platform/platform_ref.ts:138–155  ·  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

136 * Destroys all modules and listeners registered with the platform.
137 */
138 destroy() {
139 if (this._destroyed) {
140 throw new RuntimeError(
141 RuntimeErrorCode.PLATFORM_ALREADY_DESTROYED,
142 ngDevMode && 'The platform has already been destroyed!',
143 );
144 }
145 this._modules.slice().forEach((module) => module.destroy());
146 this._destroyListeners.forEach((listener) => listener());
147
148 const destroyListeners = this._injector.get(PLATFORM_DESTROY_LISTENERS, null);
149 if (destroyListeners) {
150 destroyListeners.forEach((listener) => listener());
151 destroyListeners.clear();
152 }
153
154 this._destroyed = true;
155 }
156
157 /**
158 * Indicates whether this instance was destroyed.

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected