teux / ng-cache-loader

Webpack loader to put HTML partials in the Angular's $templateCache.
83 stars 15 forks source link

Advantage using "template: require()" #15

Closed gunar closed 8 years ago

gunar commented 8 years ago

Hi!

Is using ng-cache-loader better than simply doing `template: require('mytemplate.html')'?

Thank you!

teux commented 8 years ago

ng-cache-loader stores template in cache and returns template too. If you do not want to store the template in the cache loader has no advantage.

gunar commented 8 years ago

I see. But using webpack stores the template in a kind of "cache" too, right? The template gets pre-loaded and deduplicated.

teux commented 8 years ago

Yes, it gets preloaded. This eliminates the asynchronous request, which Angular will do when it encounters a ng-include directive.

gunar commented 8 years ago

Thank you, @teux.