kaihenzler/angular-minicolors — pull request #7 by ekeijl (2014-05-09 14:14:00+00:00)
Title: Removed scope.$apply from ngModel.$render

We've been running into some digest errors with the minicolors directive.

In your code you check if there is an active digest cycle using scope.$$phase. This can still cause digest errors on the root scope. Simple solution would be to also check scope.$root.$$phase, but this solution is an [anti-pattern](https://github.com/angular/angular.js/wiki/Anti-Patterns) in Angular.

If I understand correctly you only need to call $scope.$apply() from outside the Angular context. A simple $timeout seems to do the job here (with the invokeApply argument set to false, since we don't need to update the model here).