Skip to content
This repository was archived by the owner on Jan 24, 2019. It is now read-only.

Commit 454fbff

Browse files
author
Dean Sofer
committed
fix(event): Added a check for $scope.$$phase before $apply()
1 parent ff5e5b4 commit 454fbff

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

modules/event/event.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010
*/
1111
angular.module('ui.event',[]).directive('uiEvent', ['$parse',
1212
function ($parse) {
13-
return function (scope, elm, attrs) {
14-
var events = scope.$eval(attrs.uiEvent);
13+
return function ($scope, elm, attrs) {
14+
var events = $scope.$eval(attrs.uiEvent);
1515
angular.forEach(events, function (uiEvent, eventName) {
1616
var fn = $parse(uiEvent);
1717
elm.bind(eventName, function (evt) {
1818
var params = Array.prototype.slice.call(arguments);
1919
//Take out first paramater (event object);
2020
params = params.splice(1);
21-
scope.$apply(function () {
22-
fn(scope, {$event: evt, $params: params});
23-
});
21+
fn($scope, {$event: evt, $params: params});
22+
if (!$scope.$$phase)
23+
$scope.$apply();
2424
});
2525
});
2626
};

0 commit comments

Comments
 (0)