Image Not Loading in Angular 9

Discussão em 'Angular' iniciado por Ayush Naik, Agosto 19, 2025.

  1. Ayush Naik

    Ayush Naik Guest

    HTML File :

    <div>
    <img src="/src/assets/img/menu.png" alt="LOGO">
    </div>


    Here the New-Google-Logo.png is in the same folder as in the html file. But after ng serve the html page loads with other details, but not the image. Tried by directly giving a link for an image (like www.google.com/images/x.png), it works, but local file is not loading.

    Folder Tree :

    src
    -assets
    -img
    - menu.png


    Here's how it looks :

    Image path is correct, I have also added static assets in assets folder which angular-cli serves with default .angular-cli.json

    "assets": [
    "src/favicon.ico",
    "src/assets"
    ]


    Is there any thing i am missing?

    Edit 2: I get this error in console GET localhost:4200/src/assets/img/menu.png 404 (Not Found)

    Continue reading...

Compartilhe esta Página