Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match Future states #19

Closed
aitboudad opened this issue Jan 3, 2017 · 2 comments
Closed

Match Future states #19

aitboudad opened this issue Jan 3, 2017 · 2 comments

Comments

@aitboudad
Copy link
Contributor

When tying to access to /account which is lazy path it always redirect me to the static_page

export const app_states = [
    { name: 'account.**', url: '/account', lazyLoad: ... },
    { name: 'static_page', url: '/{name}', component: StaticPage },
]

to solve this the future states should be registered with the same order of it's parent or changing the matching rule

@christopherthielen
Copy link
Member

I added a test for your scenario:

core/test/urlRouterSpec.ts

Lines 305 to 326 in f07b369

// Test for https://github.com/ui-router/core/issues/19
it("should obey rule priority ordering", (done) => {
let registry = router.stateRegistry;
let loadedState;
const lazyLoad = () => {
loadedState = registry.register({ name: 'lazy', url: '/lazy' });
return null;
};
registry.register({ name: 'lazy.**', url: '/lazy', lazyLoad: lazyLoad });
registry.register({ name: 'param', url: '/:param', });
router.transitionService.onSuccess({}, trans => {
expect(trans.$to()).toBe(loadedState);
expect(trans.redirectedFrom().to().name).toBe('lazy.**');
done();
});
router.urlService.url('/lazy');
})
})

@aitboudad
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants