Skip to content

Commit b00f044

Browse files
fix(ui-sref): Use either .on or .bind for click handlers
Closes #3035
1 parent a3136ae commit b00f044

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/ng1/directives/stateDirectives.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ function $StateRefDirective($state: StateService, $timeout: ITimeoutService) {
181181

182182
if (!type.clickable) return;
183183
hookFn = clickHook(element, $state, $timeout, type, function() { return def; });
184-
element.on("click", hookFn);
184+
element[element.on ? 'on' : 'bind']("click", hookFn);
185185
scope.$on('$destroy', function() {
186-
element.off("click", hookFn);
186+
element[element.off ? 'off' : 'unbind']("click", hookFn);
187187
});
188188
}
189189
};
@@ -234,9 +234,9 @@ function $StateRefDynamicDirective($state: StateService, $timeout: ITimeoutServi
234234

235235
if (!type.clickable) return;
236236
hookFn = clickHook(element, $state, $timeout, type, function() { return def; });
237-
element.on("click", hookFn);
237+
element[element.on ? 'on' : 'bind']("click", hookFn);
238238
scope.$on('$destroy', function() {
239-
element.off("click", hookFn);
239+
element[element.off ? 'off' : 'unbind']("click", hookFn);
240240
});
241241
}
242242
};

0 commit comments

Comments
 (0)