Closed rrrkren closed 7 years ago
I'm using the following code to test my directive (with external template):
app.directive('test-element',function(){ return { templateUrl: '/statics/template.html' restrict: 'E' } }); //test var $compile,scope; beforeEach(function(){ module('app'); inject(function(_$compile_,_$rootScope_,$templateCache){ $compile = _$compile_; scope = _$rootScope.$new(); $templateCache.put("/statics/template.html","<h1>test</h1>"); })); it ('works',function(){ var element = $compile('<test-element></test-element>')(scope) scope.$digest(); console.log(element); pending(); }
The element is not being compiled, and shown as <test-element class='ng-scope'></test-element>.
<test-element class='ng-scope'></test-element>
I've put a console.log on angular's templateCache source code, and it seems that the put is run properly but get is never used.
Can anyone point me to a correct direction? Thanks!
it turned out to be a custom httpInterceptor that screwed this up.
I'm using the following code to test my directive (with external template):
The element is not being compiled, and shown as
<test-element class='ng-scope'></test-element>
.I've put a console.log on angular's templateCache source code, and it seems that the put is run properly but get is never used.
Can anyone point me to a correct direction? Thanks!