2013-10-22 28 views
0

这里是我的测试文件:测量角指令 - 不能编译指示

describe('Clinical App', function() { 

    var template, element; 

    beforeEach(module('clinicalApp')); 

    describe('clinicalHeader', function() { 
    beforeEach(module('app/views/header.html')); 

    beforeEach(inject(function($templateCache, $compile, $rootScope) { 
     template = $templateCache.get('app/views/header.html'); 
     $templateCache.put('views/header.html', template); 
     var directive = angular.element('<clinical-header></clinical-header>'); 
     element = $compile(directive)($rootScope); 
     $rootScope.$digest(); 
    })); 

    it('should have a list of links', function() { 
     var links = element.find('a'); 
     expect(links.length).toBe(4); 
    }); 
    }); 
}); 

我不断收到一个Error: [$compile:multidir] Multiple directives [clinicalHeader, clinicalHeader] asking for template on:错误。我没有看到我加载了2次的东西。有人可以看看吗?

回答

0

这个问题是无法回答的,因为你没有所有的信息。我有一个我正在测试隐藏在控制器文件夹中的指令副本。当应用程序加载时,它也加载了该指令的额外副本。因此我得到了一个多重指令错误。