问题
i have a problem with assets path in emberjs(ember-cli).
I have 2 routes: index
and article
route, the path for index route is just a /
and the path for the article route is article/:article_id
router.js
Router.map(function() {
this.route('article', {path : '/article/:article_id'});
});
In the idnex
template, i reference my assets that are in the directory public/assets/
with the following : <img src="/assets/images/image1.jpg/>
and its work great, but when i use the same tag in the article
template, the image is not loaded, and the cause is that the client(browser) send the request to the server with the following url localhost:4200/article/assets/images/image1.jpg
.
回答1:
I had the same issue, but using the {{rootURL}}
helper solve my problem.
Example in your image tag, use something like:
<img src="{{rootURL}}assets/images/image1.jpg"/>
来源:https://stackoverflow.com/questions/41062729/relative-image-source-ember-js