Created
July 9, 2014 14:03
-
-
Save s9tpepper/fda4db10de6dca22b98d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular_module.config([ '$provide', function($provide) { | |
return $provide.decorator('$rootScope', [ '$delegate', function($delegate) { | |
$delegate.safeApply = function(fn) { | |
var phase = $delegate.$$phase; | |
if (phase === "$apply" || phase === "$digest") { | |
if (fn && typeof fn === 'function') { | |
fn(); | |
} | |
} else { | |
$delegate.$apply(fn); | |
} | |
}; | |
return $delegate; | |
}]); | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment