在Angular中,是否可以从组件而不是Angular.json导入美人鱼?

发布于 2025-02-09 20:00:57 字数 482 浏览 1 评论 0原文

我使用的是Angular 14和NGX-MARKDOWN 14.0.0与Mermaid插件(与NGX-MarkDown集成)。

如果我在Angular.json的脚本中添加“ Node_modules/mermaid/dist/mermaid.js”。

为此,我在组件中使用:

import "node_modules/mermaid/dist/mermaid.min";

但是我会发现错误:

[ngx-markdown] When using the mermaid attribute you *have to* include Mermaid files toangular.json or use imports. See README for more information

问题是,我如何从组件中加载美人鱼脚本并使NGX-Markdown起作用?

事先感谢您的帮助。

I am using Angular 14 and ngx-markdown 14.0.0 with mermaid plugin (integrated with ngx-markdown).

If I add "node_modules/mermaid/dist/mermaid.min.js" in scripts of angular.json everything works well, but I would like to load that big file only when my custom angular component loads.

For that I use in the component:

import "node_modules/mermaid/dist/mermaid.min";

but I get the error:

[ngx-markdown] When using the mermaid attribute you *have to* include Mermaid files toangular.json or use imports. See README for more information

The question is, how could I load mermaid script from the component and making ngx-markdown works?

Thanks in advance for your help.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文