Skip to content

$stateProvider.decorator won't run if state definition is declared before decorator. #1544

Closed
@wawyed

Description

@wawyed

Because of the way state are defined, unless you define the decorator in the same angular module the state configuration is defined or you ensure that your state configuration objects are in modules that depend on the module your decorator is defined; the decorators won't get called by ui-router since those states have already been resolved.

I don't think the order of definition should affect how the decorators are run. Possibly the states should be read at run block not at config block to avoid this issue.

Plunker reproducing the issue:
http://plnkr.co/edit/C1ze61?p=preview

You can see how the decorator that it's defined in a dependant module gets called but the one that it's defined in the same module doesn't (because it was called after the state definition).

This issue is not exclusive to 0.2.12 as it was happening in 0.2.11.

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions