The double asterisk path in the final route acts as a wildcard. When the requested URL does not match any of the paths defined earlier in the configuration, the router will select this route. This can be utilized to show a "404 - Not Found" page or redirect to another route.
app.module:
import { HelloComponent } from './hello.component';
import { PageNotFoundComponent } from './page-not-found/page-not-found.component';
const appRoutes: Routes = [
{ path: 'hello', component: HelloComponent },
{ path: '**', component: PageNotFoundComponent } <---
];
@NgModule({
imports: [ BrowserModule,RouterModule.forRoot(
appRoutes,
), FormsModule ],
declarations: [ AppComponent, HelloComponent, PageNotFoundComponent ],
bootstrap: [ AppComponent ]
})
https://stackblitz.com/edit/angular-ibrovt?file=src/app/app.module.ts
I trust this information is useful!