Does Angular2 use Web Components?

前端 未结 1 1171
悲哀的现实
悲哀的现实 2020-11-29 11:35

I\'ve heard a lot of talk about the second coming of Angular and there seems to be a lot of fantastic things coming out of it but I know that Angular 1.0 does not have out o

相关标签:
1条回答
  • 2020-11-29 12:03

    update 2

    That's now supported https://angular.io/guide/elements

    update

    There is an ongoing effort (currently only experimental) to change that - Angular elements https://moduscreate.com/blog/angular-elements-ngcomponents-everywhere/

    original

    Web components can be used in Angular2 applications, but Angular2 components can't be consumed as web components.

    AFAIK there are no short-term plans to make Angular2 components actual web components. This was a goal at the beginning but turned out to be too complicated.

    With the per component setting ViewEncapsulation.Native, shadow DOM is used, but that doesn't work too well in Angular2 because the browsers lack features to style the shadow DOM. Polymer uses emulated CSS variables and mixins but Angular2 doesn't yet provide anything like that.

    Currently the default setting is ViewEncapsulation.Emulated where some style scoping is emulated.

    0 讨论(0)
提交回复
热议问题