本文介绍了将图像保存在Angular 2的资产文件夹中是否是强制性的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

图像以公开形式保存在资产"目录中,但可以保存在各个组件中,以便HTML文件可以轻松访问

Images are kept in "assets" directory as its public but can it be kept in respective components so HTML files can easily access

推荐答案

不需要将图像放入资产项目.

It is not required to put images in assets project.

资产文件夹已预先配置.当您运行build命令时,资产文件夹中的所有内容都会自动复制到输出文件夹(dist)中以进行发布.因此,无需手动复制.

Asset folder is preconfigured. When you run build command then all the things in asset folder will copied to output folder(dist) automatically for publish. So no need to copy manually.

您还可以将其他文件夹配置为资产.请参见下面的代码示例.

You can also configured different folder as a asset. see in below code sample.

  "assets": [
    "assets",
    "xyz",
    "favicon.ico"
  ],

这篇关于将图像保存在Angular 2的资产文件夹中是否是强制性的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 20:40