I have a view being loaded with an embedded text/ng-template
which is not being found by a ng-include
later in the file. The script block sits at the very top of the view file:
<script type="text/ng-template" id="stringCondition">
<!-- template guts -->
</script>
Which I am loading later in the file with:
<ng-include src="'stringCondition'"></ng-include>
But is producing a 404 error in the console:
GET http://localhost/~me/stringCondition 404 (Not Found)
I've tried several variants on naming (like having .html on the end) and using ng-include
as an attribute instead of the high level element. All with no luck.
What could be causing an embedded ng-template
to not be registering with an ng-include
in the same view file?
UPDATE:
As comments and answers have pointed out, the basic design of my code is correct. But something is causing ng-template
to (apparently) fail to make the template available to the system.
I updated my code to pull from a HTML file (instead of an imbedded template) and it works fine.
Is there a common situation that I could be running into that breaks ng-template
?
ng-template
but I'm at a loss. – Endurable