Developer Snippet Diary

Implement 404 Route not found | Angular Router | Angular 15+

Generate new component 

ng generate component notfound

Modify routing 

const routesare:Routes=[
  {path:'',redirectTo:'home',pathMatch:'full'},
  {path:'home',component:HomeComponent},
  {path:'about',component:AboutusComponent},
  {path:'**',component:NotfoundComponent},
]

All path that is not found in routing will use Notfound component because of **

Posted by: R GONDAL
Email: rizikmw@gmail.com