如何将组件选择器注入到 Angular html 中

发布于 2025-01-10 16:04:42 字数 350 浏览 4 评论 0原文

我有一个要添加到仪表板的组件列表。 在此处输入图像描述

我想将其注入到 html 中,如下所示: 在此处输入图像描述

问题是我得到一个简单的字符串来代替组件: 在此处输入图像描述

有人知道为什么以及如何解决它吗?

I have a list of components that I want to add to a dashboard.
enter image description here

I want to inject it to the html like this:
enter image description here

the problem is I get a simple string in place of the component :
enter image description here

does anyone have an idea on why and how to fix it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

絕版丫頭 2025-01-17 16:04:44

您想要实现的目标可以通过动态组件加载来完成。遵循本指南https://angular.io/guide/dynamic-component-loader

What you are trying to achieve can be done by dynamic component loading. Follow this guide https://angular.io/guide/dynamic-component-loader

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文