I need it for non Angular component. Here is what I finally have:
function goToState(state) {
    angular.element(document).injector().invoke(function ($state) {
        $state.go(state);
    });
}
Seems like working.

On Tue, Oct 20, 2015 at 6:23 AM Luís Loureiro <[email protected]> wrote:

> Hi Mark.
>
> Why don't you explicit inject the service at the top of your angularjs
> component?
> Are you trying to use ui.router <https://github.com/angular-ui/ui-router>?
> If you're using the ui.router you need to change the value passed to the
> injector, pass the name of the module, "ui.router".
> angular.injector returns an $injector
> <https://code.angularjs.org/1.4.7/docs/api/auto/service/$injector>. To
> use the service you need to call get('$state').
>
> Hope this helps.
>
> Regards,
> *Luís Loureiro*
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "AngularJS" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/angular/WikWxMILSWo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to