The path problem of templateUrl in angularjs is generally written as an absolute path. Is there any way to write it as a relative path?
Now I am doing module encapsulation. Some common parts are written as instructions. I hope they can be used in other projects. However, this involves the path problem of the html template file. I hope you will give me some advice!
templateUrl: absolute/path
建议改成template: require('relative/path/template.html')
If the code is reused, I suggest you use template instead of templateUrl for two reasons
Easy to use. When using a third-party library, I generally hope to just introduce a js instead of following a bunch of stuff
Reduce http requests
As for code readability, it’s easily solved using module management and build tools
http://stackoverflow.com/questions/21835471/angular-js-directive-dynamic-templateurl
http://stackoverflow.com/questions/13681116/angularjs-dynamic-routing