Does Angular2 use Web Components?

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.

Leave a Comment