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

How to redirect to sibling or child route #136

Open
faradoxuz opened this issue Jun 28, 2020 · 1 comment
Open

How to redirect to sibling or child route #136

faradoxuz opened this issue Jun 28, 2020 · 1 comment

Comments

@faradoxuz
Copy link

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Feature request
[x] Documentation issue or request

Current behavior

when using redirectTo feature, when i use sibling route like redirectTo: 'some-route', it says
Cannot match any routes

Expected behavior

when use without slash it must begin from the route where it is

Minimal reproduction of the problem with instructions

Environment


Angular version: X.Y.Z
ngx-permissions version: X.Y.Z


Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
@faradoxuz faradoxuz changed the title How to redirect to sibling route How to redirect to sibling or child route Jun 28, 2020
@timaxapa
Copy link

timaxapa commented Aug 3, 2020

Did not find the clear solution for that. Had to do the following as quick fix

permissions: {
                        only: [UserApplicationRole.Admin, UserApplicationRole.Scheduler],
                        redirectTo: (failedPermissionName: string, route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => {
                          // TODO: Explore how to pass relative path to redirectTo
                          return state.url.replace('participants', 'details');
                        },
                      },

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