Tarun
Tarun

Reputation: 2958

Can Angular 2 Components be consumed by other Non Angular Apps using HTML Imports?

I know that angular 2 Component Directives use Shadow Dom, but i'm not clear on how deeply they adhere to web components specifications. For instance, like polymer elements, can these be consumed by other Non Angular Apps using HTML Imports?

Upvotes: 2

Views: 611

Answers (1)

unobf
unobf

Reputation: 7244

Angular 2 is not Web Components. You can use Web Components in Angular 2 applications and you will be able to co-mix Angular 2 applications inside other applications (you simply bootstrap each main application tag) as long as the custom elements and attribute bindings do not clash.

The fact that Angular 2 uses the shadow DOM is incidental. In fact in the most recent versions of the preview/alpha, the shadow DOM is not the default. I predict that the shadow DOM will very rarely be used with Angular 2 except where the application is not using any third party Angular 2 components. The reason for this is that it is difficult to create a third party component that works well in both shadow DOM and emulated shadow DOM modes.

That having been said, Angular 2 is really designed as an application development framework and not a component framework (although it is designed to create re-usable Angular 2 components for use in Angular 2 applications) If you are not using it as an application framework then you are using the wrong tool.

Upvotes: 2

Related Questions