2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Angularで画像が表示されない場合の設定確認

Last updated at Posted at 2025-06-18

はじめに

以下の通りパスを指定しても画像がブラウザに表示されない場合の対処方法(パスには画像があることを確認済)

card.html
  <img
    src="assets/images/1.jpg"
    alt="image"
  />

解決方法

angular.jsonの設定漏れを確認する

angular.json
            "assets": [
              {
                "glob": "**/*",
                "input": "public"
              },
+              "src/assets"
            ],

↑の通り、assets配列にsrc/assetsを追加して、画像認識させるように修正し、サーバー再起動すればOK

おわりに

こんな事象に20分ぐらいかけてしまった...(先は長そう...)

JISOUのメンバー募集中🔥

プログラミングコーチングJISOUではメンバーを募集しています。
日本一のアウトプットコミュニティでキャリアアップしませんか?
気になる方はぜひHPからライン登録お願いします!👇

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?