Reputation: 1639
I have $http.get all the html templates into the $TemplateCache, my question is for my directives is it more efficient to use
TemplateUrl : abc.html
or
Template : $TemplateCache.get('abc.html')?
Upvotes: 8
Views: 9328
Reputation: 18055
templateUrl
will request the html for the first time and will put it in templateCache, so only the first time you will have the hit to the server and NOT for each time.
templateCache
would avoid that hit even for the first time.
you can use this grunt to put all your templates at once in the template cache, to avoid hitting server for each template. This would make it much more efficient.
Upvotes: 13