Nicholas
Nicholas

Reputation: 1229

Angular always searches for assets folder in the parent folder

I have a project with Angular 5 that I'm deploying on my server in /var/www/html/myproject . So I can get to it to 192.168.1.1/myproject. Everything seems to work except for the 'assets' folder.

Instead of looking into 192.168.1.1/myproject/assets the server is still looking in 192.168.1.1/assets . I also tried to use 'deploy-url' in the ng build command but it remains the same.

Why is it still looking for the assets folder in the root?

This is my current command "ng build --prod --bh /myproject/ --sourcemap --deploy-url /myproject/"

Upvotes: 0

Views: 1427

Answers (1)

Nicholas
Nicholas

Reputation: 1229

In my case the problem was that my image src was specified like <img src='../../../assets/my_image.jpg'> . It seems I had to change this src to <img [src]="'assets/my_image.jpg'"> instead to make it work with the assets folder on the server.

Upvotes: 1

Related Questions