在Angular中访问资产文件夹中的文件

发布于 2025-01-17 23:24:47 字数 320 浏览 2 评论 0原文

我正在研究一个Angular项目,我在资产文件夹中有一组文件,而无需扩展文件。 ex -file1,file2,file3等。这些文件对其没有扩展名,例如.json或.txt。 我需要访问这些文件中的内容。如何访问这些文件并在其中获取数据? 请帮忙!

tia

我尝试在组件中使用'../ ../../资产/file1'的导入文件。但是得到这个错误 -

Cannot find module '../../assets/file1' or its corresponding type declarations
```.

I'm working on a Angular project, I have a set of files in the assets folder without extension for the file.
Ex - File1, File2, File3 and so on.. these files doesn't have extensions to it such as .json or .txt.
I need to access the content in these files. How can I access these files and get the data inside it?
Kindly help!

TIA

I tried using import file from '../../assets/file1' in the component. But getting this error -

Cannot find module '../../assets/file1' or its corresponding type declarations
```.

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

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

发布评论

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