I put image in public/assets/images/image1.jpg
in template
but I get 404 not found this image?why?
I put image in public/assets/images/image1.jpg
in template
but I get 404 not found this image?why?
Read the first couple sentences of The Ember CLI - Introduction - Ember CLI Guides
this is my code in template
<img src="assets/images/image1.jpg" >
but not see anything
and console print this http://localhost:4200/assets/images/image1.jpg [HTTP/1.1 404 Not Found 3079ms]
They go in the public folder
Would you give me a complete example of local image usage,please?
in The Ember CLI - Introduction - Ember CLI Guides explaination is too embigulous to let me know
For example, if you place logo.png in public/assets/images, you can reference it in templates with assets/images/logo.png or in stylesheets with url('/assets/images/logo.png')
Please let us know what part is ambiguous. We want to be clear.
so this is wrong(beginner way to use tag ‘img’)
The website don’t say “must” use in stylesheets with url(‘/assets/images/logo.png’) ,it is my misunderstand on tag ‘img’
No it’s not wrong to use an img
tag.
finaly I found <img src="assets/images/image1.jpg" alt="some_text" />
is okay .
The css way is OK too.
Because in “/>” The / is what I lost key in . (so sily)
Nice information.
In my app, I code url as follows respectively in css file and js file, and they works well in browsers of both PC and mobile device, and in a cordova app as well.
In app.css
#btnPlay {
background:url(media/images/play-sm.png)
In app.js
let btnA = document.getElementById('btnPlay');
btnPlay.background = "url(assets/media/images/play-sm.png)";
Actually, in ember 2.7.0
, <img src="assets/image/image.png">
doesn’t work (it generates a 404 in nested routes) but <img src="/assets/image/image.png">
(with /
before assets) works.
you are really smart! It has bothered me a lot.
Great information, thanks for sharing!