I have my normal and simple route app.routing.ts
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { LoginComponent } from '../login/login.component';
import { HomeComponent } from '../home/home.component';
import { CursosComponent } from '../cursos/cursos.component';
import { CursoDetalheComponent } from '../cursos/curso-detalhe/curso-detalhe.component';
import { PageNotFoundComponent } from '../page-not-found/page-not-found.component';
const PORTAL_ROUTER: Routes = [
// { path: '', redirectTo: '/dashboard', pathMatch: 'full' },
{ path: '', component: HomeComponent },
{ path: 'login', component: LoginComponent },
{ path: 'cursos', component: CursosComponent },
{ path: 'curso/:id', component: CursoDetalheComponent },
{ path: '**', component: PageNotFoundComponent },
];
@NgModule({
imports: [ RouterModule.forRoot(PORTAL_ROUTER)],
exports: [ RouterModule ]
})
export class PortalRoutingModule {}
the basic routes work localhost / login or localhost / courses, however, when I visualize the route with parameter, in the case the id, it shows me as follows localhost / courses / course / 1 and of course this will give error, as it would have to show localhost / course / 1, this is correct way