0

first time i call an url in angular application, the engine gets all templates (external files).I suppose it retrives them for caching. Is there a method to avoid this, and call only the interested template?

thank you

Belsen
  • 313
  • 3
  • 4
  • 17

1 Answers1

0

The best way is to use a build tool such as Grunt or Gulp and automate your build process. You can install a package that will load all your templates via a set path, convert them into angular template files and concattenate them into one file. Then your angular app will only have to load one file and they are loaded into memory straight away.

Grunt plugin: https://github.com/ericclemmons/grunt-angular-templates

Gulp plugin: https://github.com/miickel/gulp-angular-templatecache

If you don't want to use a build tool you can also embed the templates inline and refer to them via a unique I.D.

Example: Angularjs: Multiples partials in single html?

Community
  • 1
  • 1
sidonaldson
  • 24,431
  • 10
  • 56
  • 61