opitzconsulting / jquery-mobile-angular-adapter

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

Call a function from a Shared Controller while routing #145

Closed mvand closed 11 years ago

mvand commented 11 years ago

I didn't understand the behavior of onActivate property while routing.

Here is a part of my code: when('/conferences/:day', { templateUrl: '#conferences', onActivate: 'setDay(day)', jqmOptions: {transition:'slide'} }) And when i navigate to /conferences/2, my function setDay isn't called. How to make this ?

tbosch commented 11 years ago

Hi, Yes, this should work, if your controller adds the setDay function to the scope... Could you provide a jsfiddle?

Tobias

tbosch commented 11 years ago

Hi, here is a simple example: http://jsfiddle.net/ZHKBA/123/

Does this help?

Tobias

mvand commented 11 years ago

Ok so it works with a simple ng-controller. I tried to combine onActivate with a ngm-shared-controller and that's why onActivate was never called.

Thxs.

tbosch commented 11 years ago

Hi, this is also working with a shared controller, see here: http://jsfiddle.net/tigbro/ZHKBA/125/ Please note that with shared controllers you have to add the prefix of the shared controller to the onActivate expression.

Closing this as not a bug. Tobias