Skip to content

Instantly share code, notes, and snippets.

@eibrahim
Created April 23, 2013 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eibrahim/5447275 to your computer and use it in GitHub Desktop.
Save eibrahim/5447275 to your computer and use it in GitHub Desktop.
Angular safeApply helper
$rootScope.safeApply = (fn) ->
phase = $rootScope.$$phase
if phase is "$apply" or phase is "$digest"
fn() if fn and (typeof (fn) is "function")
else
@$apply fn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment