Reputation: 751
I wrote single file with directive templates. This file is appended to document using ng-include
directive. Sometimes browser load templates before directive template binding, but not always.
https://plnkr.co/edit/SNhVU6BoM0nbOelJpepE?p=preview
Is there some solution to wait after ng-include
directive apply html content to document and after that bind directive templates? Maybe should i use different solution to load these templates to html document.
Upvotes: 0
Views: 85
Reputation: 9476
Angular has 2 builtin possibilities:
<script src="templates.js"></script> in which: app.run(function($templateCache) { $templateCache.put('templateId', '<div></div>') })
template1.html
, templat2.html
...
(Async templates)P.S. During development templates are always in separate html files, for production usage templates are gathered to js files using build tools.
Upvotes: 1