opitzconsulting / jquery-mobile-angular-adapter

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

Communication between controllers #113

Closed avandijk closed 11 years ago

avandijk commented 11 years ago

Hi,

I just got into this great adapter but I'm a bit struggeling with the communication between different controllers. I looked into the new $location service and using the 'onactivate' to specify the function to invoke when a page is activated. It seems that in my code the function 'load()' is never called. Am I doing something wrong here...?

see http://jsfiddle.net/vFxP7/

thx Arjan

tbosch commented 11 years ago

Hi, two points to note here:

  1. Only use one ng-app for the whole application (e.g. put it at the body-tag), but not one on every mobile page. In jsfiddle, you can do this by clicking on the "info"-Button to the left, there you can edit the body-tag.
  2. The expression in onActivate can refer to the properties in the resolve object of the routeOverride. So instead of onActivate(filter) use onActivate(name) with locals: {name: 'test'}.

Here is an updated jsfiddle that works: http://jsfiddle.net/vFxP7/1/

Tobias

avandijk commented 11 years ago

Perfect.

avandijk commented 11 years ago

Thx!!!!!!