Angular 6 - 404 on image urls

1,372 views
Skip to first unread message

Siddhu Arevindh

unread,
Jul 5, 2018, 5:38:15 AM7/5/18
to Angular and AngularJS discussion

Can anyone help me with my weird question?

The basic structure of the project 

Using Django as backend.

--/ <root>
---- assets
------ angular
-------- [ all angular generated files ]
---- v2
------ [ Just the index.html file ]
---- api
------- [ Django handles requests ]



I'm building with 

ng build --output-hashing none --named-chunks false --prod --build-optimizer --base-href /v2/ --deploy-url /assets/angular/  

The problem 


I need the image URLs relative to deploy-url but the base URL should be /v2/


I tried changing the base-href same to deploy url but the whole structure changed url in the browser should be  should be /v2/

Sibusiso Massango

unread,
Jul 5, 2018, 6:09:19 AM7/5/18
to ang...@googlegroups.com
Hi  Siddhu

Change the location of your assert to just 'assets/img/' instead of '/v2/assets/img/'

that's how i solved it.

Kindly Regards
Sibusiso Massango
Alternative Email: massa...@gmail.com


--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Siddhu Arevindh

unread,
Jul 5, 2018, 7:15:48 AM7/5/18
to Angular and AngularJS discussion

Guess its already like that, what I did as a workaround was declaring an env variable and appending it with the image path.

      <a class="nav-link" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false" dropdownToggle (click)="false">
        <img src="assets/img/avatars/6.jpg" class="img-avatar" alt="ad...@bootstrapmaster.com"/>
      </a>


To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages