Reputation: 873
I have some images and style sheets files inside assets folder in angular 2 app but how to access those files and images in main index.html file?
Upvotes: 46
Views: 94820
Reputation: 1283
It's one step behind /app. So if you are inside app/components/page/page.css, reference url(/assets/images/logo.png)
Upvotes: -3
Reputation: 103
Directly refer assets folder and inside images working
<img src="/assets/img_avatar.png" />
Upvotes: 4
Reputation: 924
You have to put your files and use the relative path from the assets folder.
For example if i put a css file in src/assets/css/myfile.css
, then I have to access it like this :
<link rel="stylesheet" href="assets/css/myfile.css">
Upvotes: 80