$defer service should always call $eval after callback finished

Closes #189
This commit is contained in:
Igor Minar
2010-12-10 11:39:32 -08:00
parent 23fc73081f
commit b370fac4fc
3 changed files with 56 additions and 4 deletions

View File

@@ -819,12 +819,16 @@ angularServiceInject('$xhr.bulk', function($xhr, $error, $log){
* @param {function()} fn A function, who's execution should be deferred.
*/
angularServiceInject('$defer', function($browser, $exceptionHandler) {
var scope = this;
return function(fn) {
$browser.defer(function() {
try {
fn();
} catch(e) {
$exceptionHandler(e);
} finally {
scope.$eval();
}
});
};