Check $rootScope.$$phase before triggering a digest (fixes #15).