$ TemplateCache or TemplateUrl for directive

I have $ http.get all html templates in $ TemplateCache, my question in my directives is more efficient use

TemplateUrl : abc.html 

or

 Template : $TemplateCache.get('abc.html')? 
+7
angularjs angularjs-directive
source share
1 answer

templateUrl will request html for the first time and put it in templateCache, so only the first time you get a defeat on the server and NOT for every time.

templateCache will avoid this hit even the first time.

You can use this grunt to put all of your templates at once in the template cache to avoid getting a server for each template. This will make it much more efficient.

+11
source share

All Articles