From b00f04485c8bb6436e1811259e69e904e4dd084b Mon Sep 17 00:00:00 2001 From: Chris Thielen Date: Tue, 27 Sep 2016 19:25:15 -0500 Subject: [PATCH] fix(ui-sref): Use either .on or .bind for click handlers Closes #3035 --- src/ng1/directives/stateDirectives.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ng1/directives/stateDirectives.ts b/src/ng1/directives/stateDirectives.ts index c2f39abb..e8208bc2 100644 --- a/src/ng1/directives/stateDirectives.ts +++ b/src/ng1/directives/stateDirectives.ts @@ -181,9 +181,9 @@ function $StateRefDirective($state: StateService, $timeout: ITimeoutService) { if (!type.clickable) return; hookFn = clickHook(element, $state, $timeout, type, function() { return def; }); - element.on("click", hookFn); + element[element.on ? 'on' : 'bind']("click", hookFn); scope.$on('$destroy', function() { - element.off("click", hookFn); + element[element.off ? 'off' : 'unbind']("click", hookFn); }); } }; @@ -234,9 +234,9 @@ function $StateRefDynamicDirective($state: StateService, $timeout: ITimeoutServi if (!type.clickable) return; hookFn = clickHook(element, $state, $timeout, type, function() { return def; }); - element.on("click", hookFn); + element[element.on ? 'on' : 'bind']("click", hookFn); scope.$on('$destroy', function() { - element.off("click", hookFn); + element[element.off ? 'off' : 'unbind']("click", hookFn); }); } };