Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(swipe): safe apply the callback
Browse files Browse the repository at this point in the history
Fixes the swipe directive occasionally throwing "$digest in progress" errors.

Fixes #8318.
  • Loading branch information
crisbeto committed May 18, 2016
1 parent c26842a commit 342fd89
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/swipe/swipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ function getDirective(name) {
return DirectiveFactory;

/* @ngInject */
function DirectiveFactory($parse) {
function DirectiveFactory($parse, $mdUtil) {
return { restrict: 'A', link: postLink };
function postLink(scope, element, attr) {
var fn = $parse(attr[directiveName]);
element.on(eventName, function(ev) {
scope.$apply(function() { fn(scope, { $event: ev }); });
$mdUtil.nextTick(function() { fn(scope, { $event: ev }); });
});
}
}
Expand Down

0 comments on commit 342fd89

Please sign in to comment.