Angular2 relative paths for templateUrl and styleUrls?

落花浮王杯 提交于 2019-11-28 08:50:36
Pardeep Jain

Resolved my Problem by changing path (from src to dist)of importing file at the run time like this :-

moduleId: module.id.replace("/dist/", "/src/")

By doing so you can change path directory of module ID.

thanks to @Nicolai for this awesome comment

PS:- Posting as answer may help someone

I also had some questions about what worked and didn't work for TemplateUrl paths. I found the following was true in my testing:

templateUrl: 'folder name / file name' did not work

templateUrl: '/folder name / file name' did not work

templateUrl: './folder name / file name' DID work

so you might try that out.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!