ajoslin / angular-mobile-nav

An angular navigation service for mobile applications
http://ajoslin.github.com/angular-mobile-nav
MIT License
786 stars 135 forks source link

Access $navigate from outside the html code #70

Closed omri-shaiko closed 10 years ago

omri-shaiko commented 10 years ago

How can i access the $navigate from outside the html?

Thanks

ajoslin commented 10 years ago

It's just a service, so inject it :-)

function MyCtrl($scope, $navigate) { }

On Mon, Jul 22, 2013 at 12:35 PM, omri-shaiko notifications@github.comwrote:

How can i access the $navigate from outside the html?

Thanks

— Reply to this email directly or view it on GitHubhttps://github.com/ajoslin/angular-mobile-nav/issues/70 .

omri-shaiko commented 10 years ago

Thanks, i didn't explain myself properly. How can i use the $navigate from outside angular, for example from the console in chrome dev tools?

My problem is that i have a function inside a script which is not a angular script, and i want to use the $navigate from there..

Thanks again!

ajoslin commented 10 years ago

angular.injector.get('$navigate').go('/abc'); angular.element(document).scope().$apply();

On Mon, Jul 22, 2013 at 2:11 PM, omri-shaiko notifications@github.comwrote:

Thanks, i didn't explain myself properly. How can i use the $navigate from outside angular, for example from the console in chrome dev tools?

My problem is that i have a function inside a script which is not a angular script, and i want to use the $navigate from there..

Thanks again!

— Reply to this email directly or view it on GitHubhttps://github.com/ajoslin/angular-mobile-nav/issues/70#issuecomment-21363776 .

omri-shaiko commented 10 years ago

Are you sure? i'm getting an error. (Tried also in the demo)

omri-shaiko commented 10 years ago

Working! thanks!