简体   繁体   English

用于管理员/用户场景的 Angular 模块

[英]Angular modules for admin/user scenario

I'm designing an Angular application which has admin and basic user view of every major feature.我正在设计一个 Angular 应用程序,它具有每个主要功能的管理员和基本用户视图。

Let's say I have two features - Users and Products , where each User can have none or many Products .假设我有两个功能——用户产品,每个User可以没有或有很多Products

Each User can create, view and manage their own profile and connected Products .每个User都可以创建、查看和管理自己的个人资料和连接的Products Admin can create, view and manage all Users and all Products , as well as Products for each User .管理员可以创建、查看和管理所有Users和所有Products ,以及每个UserProducts

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.您可以使用 angular 守卫来限制普通用户访问您的管理模块。 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.通过这种方式,您可以保持模块分离,甚至还可以实现特定于每个模块的延迟加载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Angular 6-身份验证管理员用户和root用户 - Angular 6 - Authentication admin user and root user 在 angular 中有一个管理员和用户路由结构 - have an admin & user routing structure in angular 如何以角度分开添加用户和管理员导航 - How to add User and Admin navigation separate in angular 如何在角度项目中分隔管理员和用户? - how to separate admin and user in angular project? 如何以角度分隔管理区和用户区 - How to separate admin and user area in angular Angular 2(4)中的模块 - Modules in Angular 2(4) 在Angular中,是否可以根据用户是否通过身份验证来加载不同的模块? - In Angular, is it possible to load different modules depending upon whether the user is authenticated or not? 如果我需要公共组件中的开放触发器,如何将管理和公共组件解耦到 Angular 中的单独模块中? - How to decouple admin and public components into separate modules in Angular if I need an open trigger in public components? 一种将Angular 4应用拆分为面向用户和管理的方法 - A way split an Angular 4 app into user-facing and admin parts 通过 AWS Cognito 和 Angular 中的管理员角色以编程方式创建用户 - Create a user programmatically through the Admin role in AWS Cognito and Angular
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM