Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$TemplateCache or TemplateUrl for directive

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')? 
like image 723
exiadbq Avatar asked Mar 02 '14 12:03

exiadbq


1 Answers

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.

like image 145
harishr Avatar answered Sep 26 '22 13:09

harishr