Angular modules for admin/user scenario

450 Views Asked by At

I'm designing an Angular application which has admin and basic user view of every major feature.

Let's say I have two features - Users and Products, where each User can have none or many Products.

Each User can create, view and manage their own profile and connected Products. Admin can create, view and manage all Users and all Products, as well as Products for each User.

I'd like to avoid loading admin-specific stuff for basic users and vice-versa. I guess lazy-loading is the key. My question is do I create one module for each feature and divide basic, admin and shared stuff inside, or should I make basic, admin and shared my main modules, and divide from there?

Or is there a better approach I'm not thinking of?

1

There are 1 best solutions below

0
On

You can use angular guards to restrict normal user to access your Admin module. In my opinion you should have separate modules for Admin, User, Products and Shared to share common resources across. In this way you can keep the modules separated and even implement lazy loading specific to each module as well.