Jasmine tests AngularJS Directives with templateUrl

前端 未结 8 705
执笔经年
执笔经年 2020-12-07 12:54

I\'m writing directive tests for AngularJS with Jasmine, and using templateUrl with them: https://gist.github.com/tanepiper/62bd10125e8408def5cc

However, when I run

8条回答
  •  日久生厌
    2020-12-07 13:47

    If this is still not working , use fiddler to see the content of the js file dynamically generated by htmltojs processor and check the path of template file.

    It should be something like this

    angular.module('app/templates/yourtemplate.html', []).run(function($templateCache) {
      $templateCache.put('app/templates/yourtemplate.html', 
    

    In my case , it was not same as I had in my actual directive which was causing the issue.

    Having the templateURL exactly same in all places got me through.

提交回复
热议问题