访问项目文件夹外的文件

时间:2017-12-19 04:33:16

标签: angular docker directory

我正在开发一个角度5的应用程序,我有一些问题访问一些文件。让我告诉你我的项目是如何设置的,这样你就可以看到问题了。

    • desired_files
    • angularApp
    • app_generating_files

所以我的问题是我需要能够从我的角度应用程序访问desired_files文件夹中的文件。进入此文件夹的文件也是由我的根目录中的另一个项目生成的。如果您对如何做到这一点有任何想法,我们将不胜感激。

(我在app_generating_files项目中使用Docker,所以我不确定尝试使用它是否是个好主意。

1 个答案:

答案 0 :(得分:0)

您正在寻找答案的开头是:Angular-cli: How can I access images outside of the assets folder

在glob对象中,请务必添加 allowOutsideOutDir

{
  "glob": "**/*",
  "input": "../../path/to/files",
  "output": "./assets/outside-assets",
  "allowOutsideOutDir": true
}

例如,如果您在“ ../../ path / to / files ”目录中有一个名为test.jpg的图像,则可以使用标记将其包含在项目中

<img src="assets/outside-assets/test.jpg" alt="not found">

确保ng-cli的本地版本为1.5.0,因为较新版本不支持 allowOutsideOutDir ,如此处所述https://github.com/angular/angular-cli/issues/8783

相关问题