1

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.

KarimS
  • 3,812
  • 9
  • 41
  • 64
  • What is your ember version? [Deprecation of `baseURL`](http://emberjs.com/blog/2016/04/28/baseURL.html) may caused this. – ykaragol Dec 09 '16 at 15:50

1 Answers1

2

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"/>
Ember Freak
  • 12,918
  • 4
  • 24
  • 54
Falke
  • 356
  • 2
  • 4