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')?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With