Created
September 17, 2013 15:21
-
-
Save janv/6595829 to your computer and use it in GitHub Desktop.
use wrapply to wrap your callbacks in $rootScope.$apply()
This file contains hidden or 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('wrapply', []).factory('wrapply', ['$rootScope', function($rootScope){ | |
return function wrapply(originalCallback){ | |
return function wrappedCallback(){ | |
var args=arguments, self=this, retval; | |
$rootScope.$apply(function(){ | |
retval = originalCallback.apply(self, args); | |
}); | |
return retval; | |
} | |
} | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment