简体   繁体   中英

Angular modules for admin/user scenario

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM