opitzconsulting / jquery-mobile-angular-adapter

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

Feature request: Handle multiple options in $navigate #15

Closed MisterK closed 12 years ago

MisterK commented 12 years ago

Hi,

Firstly, thank you very much for this useful project!

I wanted to point out that, for now, $navigate accepts a single argument in the form ´[transition]:pageId´. It would be great to split this argument into two, the first one still being the pageId and the second one being of the same type of object that $.mobile.changePage accepts as a second 'options' argument, so that we can specify the 'reverse' attribute, the 'role', the 'reloadPage', etc. (as all listed here: http://jquerymobile.com/demos/1.0/docs/api/methods.html). It would be more coherent to the original jQueryMobile capabilities, though still easily adaptable to a different library (like Sensa Touch). The 'back' transition can still be handled if set in the 'transition' attribute of this second argument.

Thanks in advance, MisterK

tbosch commented 12 years ago

Hi, yes, you are right. Could you spare some time to create a pull request? You need to change the following files:

Please keep in mind to stay backwards compatible by analyzing the arguments of the function for their type, e.i. if the second argument is an object then it's the jquery mobile options object. Otherwise, it's the callback that I added in the latests version of the adapter.

Tobias

tbosch commented 12 years ago

Hi, the syntax is now as follows, if you want to pass a custom object to jquery mobile changePage function: var obj = {target: 'page2', transition:'pop', ...} $navigate(obj);

Please note that the additional property "target" is required in the object that is passed in.

Tobias