opitzconsulting / jquery-mobile-angular-adapter

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

$navigate onActivate Function triggering a function of a ngm-shared-controller #87

Closed pascalwhoop closed 11 years ago

pascalwhoop commented 11 years ago

Hello there! I wanted to refactor my UI, having only 1 Page for several Listviews and then showing the correct data respectively via showPickupList() or showReceiveList() functions within the listView Controller.

These functions get triggered before one navigates to the page using the $navigate("#listView", "showPickupList") function. However now I must add a details Page which needs me to make the controller shared for both pages to access the detailed values of the selected item. If I try to access the function of this now shared controller via the $navigate function now it fails.

Is it not possible to use these two features combined or am I doing something wrong? I will try and toss up a jsfiddle if i manage to get it all in there (rather more code to code :( )

But to summarize:

ngm-shared-controller function not accessible via $navigate function from previous page.

this: $navigate("#listView", "listCtrl.showPickupList")

don't work for me.

Thanks for your coding efforts! Kind regards

tbosch commented 11 years ago

Hi, $navigate is gone, but there are new function on $location instead. Migration guide: https://github.com/tigbro/jquery-mobile-angular-adapter/blob/master/Changelog.md

Also, the onActivate property on routes is now an expression, i.e. this can call also functions in a shared controller.

Here is a jsfiddle that uses a shared controller on the new onActivate expression: http://jsfiddle.net/FL5Wf/7/ Tobias