opitzconsulting / jquery-mobile-angular-adapter

jquery mobile angular adapter
MIT License
517 stars 114 forks source link

recommended way of changing page programmingly #211

Closed fxfred closed 11 years ago

fxfred commented 11 years ago

Thank you for your great work.

I tried changePage() to change page first, but because the url hash is not updated, the back button doesn't work correctly.

Since changePage() is not recommended for changing page, what's the recommended way to do it simply?

Thanks again.

tbosch commented 11 years ago

Hi, the recommended way is to use $location, just like you would in any other angular app. See this jsfiddle: http://jsfiddle.net/4AEQK/12/

Use $location.url("#somePage") for jqm pages that are declared in the index.html, and $location.url("somePage.html") if your jqm page is located as a seaprate html file.

Tobias

fxfred commented 11 years ago

Thank you Tobias,

It works. :)

Fred