Angular 1.2.24: Testing directive throws undefined in scope.$digest();
问题 I've just installed AngularJS 1.2.24 and I'm trying to test my directive. The code looks like follows: describe('scenarios', function () { var scope, compile; beforeEach(module("app")); beforeEach(module("src/widgets/tt-header/header.html")); beforeEach(inject(function ($compile, $rootScope) { scope = $rootScope.$new(); compile = $compile; })); function directive() { var el = angular.element('<div tt-header />'); compile(el)(scope); scope.$digest(); return el; } it('should load the directive'