7

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 of the box integration for Web Components.

I've read up some about Angular2 and that it no longer uses directives. So I was wondering if that means Angular2 is going to make use of Polymer/HTML Templates and other Web Components without any extra integration?

Caden Albaugh
  • 213
  • 4
  • 10
  • 3
    Nope. Angular components borrow some concepts from WCs but that's all. It still needs some efforts to make Polymer and A2 work together. See https://github.com/vaadin/angular2-polymer The things may change with Polymer 2. – Estus Flask Oct 24 '16 at 20:30

1 Answers1

11

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.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • 1
    It's now 2.5yrs since your initial answer. Are you aware of any updates (maybe there's a dedicated Github issue for it?) on Angular 2 support for Angular component to be rendered as Web Componinets instead of emulating it? – Alexander Abakumov Apr 24 '19 at 16:50
  • https://angular.io/guide/elements https://medium.com/@tomsu/building-web-components-with-angular-elements-746cd2a38d5b – Günter Zöchbauer Apr 24 '19 at 16:57
  • Here it is mentioned how to use angular component as web component. https://moduscreate.com/blog/angular-elements-ngcomponents-everywhere/ – Muzaffar Mahmood Sep 29 '20 at 09:25