1

I am trying to unittest our angular directives which are implemented with external templates. As far as I can find there are only two options:

  1. use $httpBackend to respond with the template when requested in the directive
  2. use the preprocessor created for Karma to fill the $templateCache

Number 1 is really not convenient and probably quite errorprone since we have to keep the actual template and the respond version in sync. Number two is not an option since we are not in a position to install karma on our CI environment (TFS Online).

Have I missed something? Are there any other options?

Thanks, Casper

Casper
  • 90
  • 7

1 Answers1

0

Use the following process:

  • Download the templates using a tool (curl, grunt, gulp)
  • Concatenate the files
  • Move the concatenated file to your runtime template directory
  • Reference the concatenated file in the templateCache
  • Add the templateCache to your module

References

Community
  • 1
  • 1
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265