admin

Please wait...

New Page

Create a new module

For create new module you can use following command from your root directory. module-name is a name of your desire module.

                         	
 ng generate module <module-name>
 
 e.g.
 
 ng generate module employee
							
						

Add a component to the feature module

For add new component in module you can use following command from your root directory. module-name is a name of your desire module & component-name is a name of your component.

                         	
 ng generate component <module-name>/<component-name>
 
 e.g.
 
 ng generate component employee/salary;
							
						

Steps

We are in the process of adding a new page to the admin section, specifically for managing the 'Account Module' with a focus on salary components.

  • keyboard_arrow_rightTo create a new component named salary using Angular CLI, you can run the following command
    ng g c salary

    Options Description
    ng Refers to the Angular CLI command.
    g Stands for "generate" — it tells Angular to create something new.
    c Specifies that you are generating a component.
    salary The name of the component you're creating.



  • keyboard_arrow_right If you're setting up routing for an accounts module in Angular, you would typically define routes in a accounts.route.ts file (or similarly named file depending on your project structure). Below is an example of how to structure the routing configuration for an accounts module that includes the SalaryComponent.
    
    import { Route } from '@angular/router';
    import { SalaryComponent } from './salary/salary.component';
    import { Page404Component } from 'app/authentication/page404/page404.component';
    export const ACCOUNTS_ROUTE: Route[] = [
        {
        path: 'salary',
        component: SalaryComponent,
        },
    
        { path: '**', component: Page404Component },
    ];
    
                                   

  • keyboard_arrow_right To integrate the Accounts module routing into the admin.routes.ts file, you would need to include a route that points to the AccountsModule. Assuming you're structuring the admin.routes.ts file to include links to different modules, here's an example of how to modify admin.routes.ts to include a route for AccountsModule (and indirectly for SalaryComponent as part of Accounts).
    
        {
            path: 'accounts',
            loadChildren: () =>
              import('./accounts/accounts.routes').then((m) => m.ACCOUNTS_ROUTE),
          },
    
                                   

  • keyboard_arrow_right To add a new page (like the Salary page under Accounts) to your sidebar menu, you will need to update the sidebar items configuration. This configuration typically resides in a file like layout/sidebar/sidebar-items.ts, which defines the structure of the sidebar menu.
    
    {
        "path": "",
        "title": "Accounts",
        "icon": "mail",
        "class": "menu-toggle",
        "groupTitle": false,
        "submenu": [
            {
            "path": "/admin/accounts/salary",
            "title": "Salary",
            "icon": "",
            "class": "ml-menu",
            "groupTitle": false,
            "submenu": []
            }
        ]
        },
    
                                   

Thats it!


Now you can access salary page using url http://localhost:4200/#/admin/accounts/salary


Referral Url