angular/packages/platform-server
Alan Agius 02d5e8d79d fix(platform-browser): remove styles from DOM of destroyed components (#48298)
Currently style of components using `encapsulation`, `None` or `Emulated` will not be removed from the DOM once the component get destroyed.

This change addresses this by keeping track of the number of times a component is rendered, when the component is destroyed the counter is decreased and once this reaches zero the style element is removed from the DOM.

Currently, this new behaviour is on opt-in bases, but it will be changed in the next major version.

To opt-in, set the `REMOVE_STYLES_ON_COMPONENT_DESTROY` DI token to `true`.

Example
```ts
@NgModule({
 declarations: [
   AppComponent,
 ],
 imports: [
   BrowserModule
 ],
 providers: [
   { provide: REMOVE_STYLES_ON_COMPONENT_DESTROY, useValue: true }
 ],
 bootstrap: [AppComponent]
})
export class AppModule { }
```

Closes #16670

PR Close #48298
2023-02-16 15:31:24 -08:00
..
init refactor: update platform-server tests to work with ESM (#48521) 2022-12-19 19:50:43 +00:00
src fix(platform-browser): remove styles from DOM of destroyed components (#48298) 2023-02-16 15:31:24 -08:00
test fix(platform-server): insert transfer state script before other script tags (#48868) 2023-01-30 16:54:07 -08:00
testing build: reformat BUILD files (#48181) 2022-11-22 21:22:34 +00:00
BUILD.bazel build: add missing dependencies to platform-server and tools/testing (#48521) 2022-12-19 19:50:43 +00:00
index.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
package.json feat(core): add support for Node.js version 18 (#47730) 2022-10-11 17:21:19 +00:00
PACKAGE.md docs: add platform to glossary (#30731) 2019-06-12 11:46:25 -07:00
public_api.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00