angular-docs-cn/packages/core/schematics/migrations/native-view-encapsulation
Kristiyan Kostadinov 0e733f3689 feat(core): add automated migration to replace ViewEncapsulation.Native (#38882)
Adds an automated migration that replaces any usages of the deprecated
`ViewEncapsulation.Native` with `ViewEncapsulation.ShadowDom`.

PR Close #38882
2020-10-08 11:56:03 -07:00
..
BUILD.bazel feat(core): add automated migration to replace ViewEncapsulation.Native (#38882) 2020-10-08 11:56:03 -07:00
README.md feat(core): add automated migration to replace ViewEncapsulation.Native (#38882) 2020-10-08 11:56:03 -07:00
index.ts feat(core): add automated migration to replace ViewEncapsulation.Native (#38882) 2020-10-08 11:56:03 -07:00
util.ts feat(core): add automated migration to replace ViewEncapsulation.Native (#38882) 2020-10-08 11:56:03 -07:00

README.md

ViewEncapsulation.Native migration

Automatically migrates usages of ViewEncapsulation.Native to ViewEncapsulation.ShadowDom. For most practical purposes the Native mode is compatible with the ShadowDom mode.

The migration covers any reference to the Native value that can be traced to @angular/core. Some examples:

  • Inside the encapsulation property of Component decorators.
  • In property assignments for the COMPILER_OPTIONS provider.
  • In variables.

Before

import { Component, ViewEncapsulation } from '@angular/core';

@Component({
  template: '...',
  encapsulation: ViewEncapsulation.Native
})
export class App {
}

After

import { Component, ViewEncapsulation } from '@angular/core';

@Component({
  template: '...',
  encapsulation: ViewEncapsulation.ShadowDom
})
export class App {
}