I have a problem that occurs sometimes, when the template entry is not defined in the template cache, it happens every once in a while after reloading the page.
The related code:
index.html
<div ng-include src="'Views/templates.html'"></div>
Views/templates.html
<script type="text/ng-template" id="customTemplate/spare-request-item.html">
<div>..</div>
</script>
directive.js
.directive("spare", function ($templateCache) {
console.log($templateCache.info());, //return length 30 when it fails, 31 otherwise
console.log($templateCache.get('customTemplate/spare-request-item.html'));//return undefined when it fails
return {
..
templateUrl: 'customTemplate/spare-request-item.html',
Anyone else has experienced this or know how to assure that the template is loaded and parsed before the directive runs? It is a angular bug?
ng-templatescript ? To what end ?templateUrl: 'templates.html'in the directive then and remove the script wrapper ?