admin

Please wait...

Add New Role

To add a new role there are few steps you have to follow, I will explain to you every step with examples and screen shots.

Suppose you are going to add a new module Test, so first of all you have to generate modules and components using the Angular CLI command. e.g. ng g m Test for module and ng g c Test/TestComponent for component.

Now first of all you have to change in role.ts file and add new role Test. see in screenshot:

1. role.ts

Now add new user "test" in auth.service.ts file in user array. For static data, we set user array in service you can get user from the database or any other way. see in the screenshot:

2. auth.service.ts

Now you have to add "test" module entry in sidebar-item.ts file which is located in the layout/sidebar directory. To display your module in the sidebar menu. see in the screenshot:

3. sidebar-item.ts

Now need to add some role related entry in sidebar.component.ts:

4. sidebar.component.ts


In last stage you have to mention the redirect url in signin.component.ts when login success. see in the screenshot:

5. signin.component.ts

Add new image "test.png" for test user role in images/user module. Don't forget to routing code for test module in your project.


That's it!!!