Skip to content

How to inject $error$ in 1.0.0-beta.1 #2866

Closed
@spencersteers

Description

@spencersteers

In the last alpha I was able to access the error object in an onError hook through:

var redirect = ['$error$', function($error$) {
    if ($error$ && $error$.status === 404) {
        $state.go('assets');
    }
}];

Now that injections are done through the transition parameter I tried:

var redirect = function (transition) {
    var $error$ = transition.injector().get('$error$');
    if ($error$ && $error$.status === 404) {
        $state.go('assets');
    }
};

Which always produces unknown provider errors.

Is there a new way to get the error object?

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions