Create Angular Route

to add the route, firstly open the app-routing.module.ts file.

Step1:- Now import the AddEmployeeComponent in this file.


import { AddEmployeeComponent } from './add-employee/add-employee.component';

Step2:- After that, create the route and put into the route array.


const routes: Routes = [
{path:'add-employee',component:AddEmployeeComponent},
];

Step3:- Now, add the router-outlet in the app-component.html file.


<router-outlet></router-outlet>

Step4:- After save the file then open the url http://localhost:4200/add-employee

Note:-1) Hello Employee Management Tools is coming from the app.component.html file

2) add-employee works! is coming from the add-employee.component.html file