1 year ago

#75056

test-img

Ismail Wakra

Angular 9.1.5 Router empty path is not working

Actually it was working before, but today it stopped working and I didn't change anything. That's confused me. Does anyone have any idea about this?

This is my AppRoutingModule

const routes: Routes = [
{
    path: '',
    redirectTo: 'admin', pathMatch: 'full'
},

{
    path: 'admin',
    component: MainComponent,
    canActivate: [AuthService],
    children: [
        {path: '', redirectTo: 'dashboard', pathMatch: 'full'},
        {path: 'dashboard', component: DashboardComponent, data: {breadcrumbs: ['Dashboard']}},
    ]
},

{path: 'auth', loadChildren: () => import('./auth/auth.module').then(a => a.AuthModule)},
{path: '**', component: Error404Component},
]
@NgModule({
imports: [LayoutModule, RouterModule.forRoot(routes, {useHash: true})],
exports: [RouterModule]
})
export class AppRoutingModule {
}

This is my AppModule

@NgModule({
declarations: [
    AppComponent,
    DashboardComponent,
    P404Component
],
imports: [
    BrowserModule,
    AppRoutingModule,
],
exports: [],
bootstrap: [AppComponent]
})
export class AppModule {
}

angular

angular9

angular-router

0 Answers

Your Answer

Accepted video resources