I have a dilemma where I need to swap out multiple templates from a library with my own custom ones without forking the original templates. When I include the templates in my index.html page like:
<script type="text/ng-template" id="first-template">
<div class="view">
{blah} {blah}
</div>
</script>
It functions correctly. However, I have numerous templates and do not wish to clutter my index.html file with them all. I attempted loading them using the src
attribute but they failed to load.
I also tried saving my templates as both .html and .js files, but neither method worked. Why is this the case? Aren't both approaches intended for the same purpose?
I came across a similar inquiry here, however, the conversation is brief and lacks a concrete solution.
Could someone please provide a detailed explanation of the logic behind this issue and propose a viable solution?