Closed hsdk123 closed 11 years ago
Hi,
this is the same behavior as in plain angular without the adapter. Look at this fiddle http://jsfiddle.net/6BgNp/3/ and click on your links. You will see console output that shows that angular is changing it's internal location representation although you added the onclick = return false
handler.
Technically, this is not easy to implement, as angular also only registers a click listener. I know there is https://developer.mozilla.org/en-US/docs/DOM/event.defaultPrevented but this is not working on every browser...
Either way, if you are using angular and the adapter, there is a more elegant solution for the initial problem: You want to execute an action and after it preform the transition. So you do the following:
Set href=''
and add a ng-click
handler. In the handler do whatever you want and afterwards start the transition using $location.url('#p2')
.
Here is an updated fiddle: http://jsfiddle.net/ZHKBA/154/
I do not regard this as a bug in the adapter, as angular is behaving the same way.. Hope this helps and sorry for the late answer, Tobias
I have the following html for page transitions:
[a href="#p2" data-role="button" onclick="return false"]Go To Page 2[/a]
Without the adapter, the above doesn't trigger a transition due to onclick's "return false" - yet with the adapter applied, I'm getting a forced transition regardless.
Here's a jsFiddle to outline: http://jsfiddle.net/ZHKBA/139/
Required for the following: http://stackoverflow.com/questions/16159162/javascript-jquery-mobile-execute-transition-after-function-finish (jsFiddle without adapter: http://jsfiddle.net/nMR85/1292/)