小编Avi*_* Dv的帖子

Angular 6 资产文件夹未在浏览器上呈现

我正在学习 angular,我正在尝试将资产文件夹内的本地图像加载到 main.component.html 中,并且我已经正确设置了路径,同时我在打开图像的路径上执行 alt+单击。但是图像没有加载到浏览器上。

我得到 的错误在此处输入图片说明

在 Chrome 开发者工具的源选项卡中,没有 包含资产文件夹

在此处输入图片说明

这是我的角度 cli 版本 在此处输入图片说明

我试过这个https://github.com/angular/angular-cli/issues/5268但没有用,有人请帮忙这是我的 angular.json 文件

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "game-of-thrones": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {},
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/game-of-thrones",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "src/styles.css",
              "./node_modules/bootstrap/dist/css/bootstrap.min.css",
              "./node_modules/font-awesome/css/font-awesome.css"
            ],
            "scripts": [
              "./node_modules/jquery/dist/jquery.min.js",
              "./node_modules/bootstrap/dist/js/bootstrap.min.js"
            ]
          },
          "configurations": …
Run Code Online (Sandbox Code Playgroud)

assets file-not-found http-status-code-404 angular

1
推荐指数
1
解决办法
1万
查看次数