将 Angular2 组件导出为独立小部件

编程入门 行业动态 更新时间:2024-10-17 11:30:37
本文介绍了将 Angular2 组件导出为独立小部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

有没有办法将 Angular2 组件导出为独立的小部件?我知道它可能需要附加 angular2 内核本身,这不是问题(除非可以省略).

Is there a way to export Angular2 Component as a standalone widget? I am aware it would probably require attaching angular2 core itself, that is not a problem (unless can be omitted).

我的目标是创建一个完整的应用程序(系统),其中包括一个共享组件(如特定于产品的照片库).我希望该组件可以导出,以便有人可以将其包含在他们的页面上(不必是 Angular2).

My aim is to create a full app (system), which includes a shared component (like a product specific photo gallery). I would like that component to be exportable so somebody can include that on their page (which doesn't have to be Angular2).

这可能吗?

推荐答案

当我问最初的问题时它不可用,但现在可以使用 Angular Elements 将 Angular 组件导出为自定义元素:https://angular.io/guide/elements

It wasn't available back when I asked the original question, but now it is possible to export Angular Components as Custom Elements using Angular Elements: https://angular.io/guide/elements

这篇关于将 Angular2 组件导出为独立小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-26 02:56:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1128654.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:部件   组件   独立

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!