I have a multiple user Angular app, with a module for each user (because they have totally different accessible pages), like this:
- app.module.ts
- app-routing.module.ts
- login/
- login.component.ts
- admin/
- pages/
- user-management/
- configuration/
- admin.module.ts
- admin-routing.module.ts
- pages/
- user/
- pages/
- task-management/
- configuration/
- user.module.ts
- user-routing.module.ts
- pages/
- guest/
- pages/
- guest.module.ts
- guest-routing.module.ts
From the login page (/login from app-routing), I want to redirect to each module based on the credentials the user provided, but NOT with children routes like /user /admin or /guest
Instead, when an admin logs in, I want the URL to be reset. So, for example, the admin should not see the paths /admin/user-management or /admin/configuration; it just accesses /user-management or /configuration
Is this possible? Will it be a problem if I have a /configuration route for both admin and user?
EDIT: Here's a Stackblitz working example. Take a look at the URL routes when logged in.
EDIT 2: In the Stackblitz example, you can see the original problem on master and the working solution on solution branches.
auth.guard.tsimplemented to restrict pages not accessible for users without the specific role, but the problem is with the URL route itself, not the access to itUserModule,AdminModule,GuestModule), I have to do it under a subroute (/users/admin/guestrespectively). But I don't want that behavior. I want to load a submodule and use its routes under the root route (/)