-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ui-sref not working with ng-click (angular-touch) if used without jQuery #827
Comments
Any news on this? |
Submitted PR #1580 |
Submit a bug against angular-touch? As I commented in @homerjam's PR, the fact that What you're essentially suggesting is that every Angular module which implements a directive that binds click events needs to know about the ways in which |
Did some digging. See angular/angular.js#9872 and angular/angular.js#6001 (which, it looks like you opened, so there you go). |
I turned my PR into a separate module https://github.com/homerjam/angular-ui-sref-fastclick |
@homerjam Nice. Feel free to update the wiki accordingly. |
If anyone else reached here like I did because of a completely different issue. Here is the problem and the fix. Precedence of ng-click and ui-sref has changed between versions. Before, ui-sref worked before ng-click, so event.preventDefault() on ng-click did not stop ui-sref from firing, now it does. I am sure this must be somewhere in the log, but this is the first page result so it might help someone. |
Thanks @ofpiyush, so the solution would be to remove |
yes |
Hi. |
@hernancete the handler of ng-click If your html looks like <a ng-click="myClickHandler($event)" ui-sref="my.state">My State</a> and your controller has $scope.myClickHandler = function(event) {
event.preventDefault();
// Do awesome click-ey things
} Remove the line event.preventDefault(); To make it $scope.myClickHandler = function(event) {
// Do awesome click-ey things
} |
Thanks a lot for the answer. |
You don't have to write ng-click, only ui-sref will also work, Use latest or at least 0.3.2 for ui-router
|
Hi,
I have a hard time removing jQuery from our app. The main problem: a simple link combining
ng-click
withui-sref
:The result:
ng-click
fires,ui-sref
does not.This only happens when using angular-touch, without jQuery as a dependency and a mobile browser, or with the emulation of a mobile device in the new chrome 32 (I used an Nexus 4 as emulation target).
A running example: http://jsfiddle.net/scheffield/AEfMm/
To see the effect: http://jsfiddle.net/scheffield/AEfMm/show in a mobile browser
I already did a little research and found out that the
event
object is broken:It is an object containing nothing but two functions implemented as
angular.noop
.Any ideas?
The text was updated successfully, but these errors were encountered: