The following is a very general general scenario used for the test directive:
var element,scope; beforeEach(inject(function ($rootScope,$compile) { scope = $rootScope.$new() element = angular.element('<div my-directive></div>') $compile(element)(scope) scope.$digest();
I understand that $compile(element) returns a function that takes the scope parameter and exposes it to the element directive. I also understand that scope.$digest() executes a digest cycle and starts a dirty check. With all that, my question is, why should you call scope.$digest after calling $compile so that everything works in this situation?
source share