I am encountering difficulties when trying to implement isolated scope with templateUrl.
Here is my directive test:
beforeEach(ngModule('app.directives'));
var scope, compile
beforeEach(inject(function($rootScope, $compile){
scope = $rootScope.$new();
compile = $compile;
}));
it('Substitutes the element with the correct content', function(){
var element = compile('<download-detail-header></download-detail-header>')(scope);
expect(element.html()).to.equal('<p>Hello World!</p>');
});
This is my directive:
function downloadDetailHeader() {
return {
restrict: 'EA',
scope: {},
template: '<p>Hello World!</p>'
// templateUrl: 'download_detail_header/views/downloadHeader.html'
}
}
Contents of downloadHeader.html file:
<p>Hello World!</p>
The test successfully runs with the template, since ng-isolate-scope is added as a class on the directive element. However, the test fails when using the provided templateUrl, as no ng-isolate-scope is assigned to the directive element.
Can anyone offer any insights into this problem?