Angular 2组件和Web组件之间有什么区别? [英] What is the difference between Angular 2 Components and Web Components?

查看:54
本文介绍了Angular 2组件和Web组件之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很困惑.可以像Web组件一样在Angular范围之外重用Angular 2组件吗?

I'm very confused. Can an Angular 2 Component be reused outside of the Angular scope just like a Web Component?

或者可能不止于此?

推荐答案

目的是使Angular组件可重用的Web组件(如Polymer元素),并在一段时间后以这种方式进行通信.

The intention was to make Angular components reusable Web components like Polymer elements and it was communicated this way a while back.

目前对此的支持非常有限.每个Angular根组件(最外面的Angular组件)都是一个不同的Angular应用程序,并且根组件非常有限.

Currently support for this is only very limited. Each Angular root component (the outer-most Angular component) is a distinct Angular application and the root component is quite limited.

  • @Input()不在另一个Angular组件中读取属性值
  • 构造函数参数的
  • @Attribute()注释不会像在另一个Angular2组件中使用时那样注入属性值
  • 插入不起作用< ng-content> 来将现有的HTML与Angular组件一起包装
  • 每个根组件都有其自己的依赖项注入器.
  • @Input() doesn't read attribute values while it does inside another Angular component
  • @Attribute() annotation for a constructor argument doesn't inject the attribute value like it does when used inside another Angular2 component
  • transclusion doesn't work <ng-content> to wrap existing HTML with an Angular component
  • Each root component has its own injector for dependency injection.

这可能是以后要解决的任务,但据我所知,目前尚无具体信息.

This might be an open task for later but there is currently no concrete information available as far as I know.

这篇关于Angular 2组件和Web组件之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆