1
我试图将我的应用从baseURL迁移到rootURL路由器配置。我坚持确定哪些url用于存储在我的模板中的public/assets中的图像。在模板中填充rootURL
在我使用assets/images/myimage.png
之前,现在我想要做一些类似{{rootURL}}assets/images/myimage.png
的操作,但是从路由中注入它看起来相当不方便。
setupController(controller, model) {
this._super(controller, model);
this.controllerFor('application').set('rootURL', this.get('router.rootURL'));
}
是否有既定的方法来做到这一点?
在此先感谢。
可以导入像'从“应用程序名称/配置/ environment''进口配置和使用它像'config.rootURL' – kumkanillam
这似乎更优雅。谢谢。 – Luka