Skip to content

Instantly share code, notes, and snippets.

@EpokK
Created May 9, 2014 08:50
Show Gist options
  • Save EpokK/98da1874cc6a5fba318f to your computer and use it in GitHub Desktop.
Save EpokK/98da1874cc6a5fba318f to your computer and use it in GitHub Desktop.
Pour appeler correctement $scope.$apply
$scope.properApply = function(callback) {
var phase = this.$root.$$phase;
if(phase !== '$apply' && phase !== '$digest') {
$scope.$apply(callback);
}
};
@sclausen
Copy link

sclausen commented Sep 1, 2014

whats the difference to $timeout(callback)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment