DEV Community

Cover image for Create a Admin Module in Angular

Create a Admin Module in Angular

Rajib Gupta
I am a Full stack Web Developer
・1 min read

How to Create Admin in Angular by Rajib Gupta

Author - @Rajibgupta



  1. First we have to create admin module:

ng g m admin --routing

  1. --routing generates our routing module for admin automatically.

with the help of router module we can pass our admin components. Which will only access by our admin.
After the creation of admin module we have to create our component like

ng g c admin/login

  1. And for showing admin list we have to create one more component

ng g c admin/list

  1. **Then we have to define our login component and list component inside our admin-routing.module.ts file.

    import { ListComponent } from './list/list.component';

    import { LoginComponent } from './login/login.component';

    const routes: Routes = [

  2. After that go to the app.module.ts file and define admin module inside that.

    import { AdminModule } from './admin/admin.module';
    imports: [

  3. Then, we need to call our login and list component inside our parent component or app.component.html file.

    <div class="container">
    <li><a routerLink="login">Login</a></li>
    <li><a routerLink="list">List</a></li>



  4. And lastly we need for run our project by serving.

    ng serve

Thank you.

Discussion (0)