Technical concepts of Angular Elements and Stencil

痞子三分冷 提交于 2019-12-10 09:57:59

问题


Are the technical concepts of Angular Elements and Stencil similar?

Angular Elements will be a new feature in Angular 6, where u can basically wrap your written Angular component as a Web Component. In my understanding the generated Custom Element is just a bridge to Angular, so we still have to ship Angular.

Stencil, on the other side, claims to be a compiler that generates Web Components. So the generated Custom Element is not just a bridge to something?

Did i get that right?


回答1:


You shouldn't have to ship Angular as you put it. Angular Elements will allow us to use Angular components without the whole Angular Ecosystem. So if you had a React app or a VueJS app, you could take your Angular Element (thanks to Custom Element) and just plop it into those apps.

Rob Wormald did a cool talk about them with all the deets at ng-conf this year. I'd check that out for the latest info.




回答2:


yes you are right, stencil is just a compiler to generate Standard Web Components so you are able to use your web components (built with stencil) everywhere.

You can generate a web component and then use it in your Angular or React or Vue App, just load it and drop the tag and will work.



来源:https://stackoverflow.com/questions/49938504/technical-concepts-of-angular-elements-and-stencil

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!