【发布时间】:2016-12-09 14:34:29
【问题描述】:
我在 emberjs(ember-cli) 中的资产路径有问题。
我有2条路由:index和article路由,索引路由的路径只是/,文章路由的路径是article/:article_id
router.js
Router.map(function() {
this.route('article', {path : '/article/:article_id'});
});
在idnex 模板中,我使用以下内容引用了public/assets/ 目录中的我的资产:<img src="/assets/images/image1.jpg/> 并且效果很好,但是当我在article 模板中使用相同的标签时,图像没有加载,原因是客户端(浏览器)向服务器发送请求,url如下localhost:4200/article/assets/images/image1.jpg。
【问题讨论】:
-
你的 ember 版本是什么? Deprecation of
baseURL可能会导致这种情况。
标签: ember.js ember-cli ember-cli-mirage