Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.8k views
in Technique[技术] by (71.8m points)

angular - Does Angular2 use Web Components?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...