When I try to test my directive I get the TypeError: compile is not a function. Here is my test case:
describe('directive tests', function () {
var element, $compile, scope;
beforeEach(module('App'));
beforeEach(inject(function (_$compile_, $rootScope) {
$compile = _$compile_;
scope = $rootScope.$new();
}));
it('should be Hello', function () {
element = $compile('<div Hello></div>')(scope);
...
});
});
If I comment the like that define the module, (beforeEach(modue('App')), the compile works, but I can't get reference to my directive.
Aucun commentaire:
Enregistrer un commentaire