R
R
Roman Rakzin2022-01-08 17:23:24
Angular
Roman Rakzin, 2022-01-08 17:23:24

How to load different modules for admin and regular user in Angular app?

The site is one for both users and administrators.
Routing modules are loaded by lazy loading, but I would like, if a person is authorized as User, then load some basic modules, and if Admin, then others.
Now I have everything loaded that increases the size of the application.
How do experts do it? What would such a task be implemented:
There would be a common module (services) for everyone and, depending on authorization, the data would be loaded specifically for the user or admin.
Is it done through DI or through loading asynchronous modules for each type of user?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shvets, 2022-01-08
@Xuxicheta

Forwarding to different routes.
Of course, often developers want to make one route for different rights show different things, theoretically this can be done by changing the router config, but I tend to think that the path should definitely match the content. Think of the picture on the screen as a function of the route and the data. The simpler the match, the better.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question