如何将组件选择器注入到 Angular html 中
我有一个要添加到仪表板的组件列表。 在此处输入图像描述
我想将其注入到 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想要实现的目标可以通过动态组件加载来完成。遵循本指南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