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

Guard is not working with angular SSR #200

Closed
RezaT1994 opened this issue Jun 21, 2022 · 0 comments
Closed

Guard is not working with angular SSR #200

RezaT1994 opened this issue Jun 21, 2022 · 0 comments

Comments

@RezaT1994
Copy link

I'm submitting a...


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

Current behavior

Guard not working in angular ssr. When I hit refresh on browser, the home page loads at first, then immediately switches to expected route that has the canActivate option.

Expected behavior

The home page should not load at all when I hit refresh.

Minimal reproduction of the problem with instructions

const routes: Routes = [
    {
        path: '',
        component: MainComponent,
        children: [
            {
                path: 'panel',
                data: {
                    permissions: {
                        redirectTo: '/'
                    }
                },
                canActivate: [NgxPermissionsGuard],
                loadChildren: () => import('./panel/panel.module').then(m => m.PanelModule),
            },
            {
                path: '',
                loadChildren: () => import('./home-page/home-page.module').then(m => m.HomePageModule)
            }
        ]
    }
];

Environment


Angular version: 12.2.0
ngx-permissions version: 13.0.1

Browser:
- [*] Edge version 102.0.1245.44 (Official build) (64-bit)
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