Angular 2 Not redirecting to Dashboard

15 Views Asked by At

I have the below in my route:

const routes: Routes = [
    { path: '**', redirectTo: 'dashboard' },
    { path: '', component: DashboardComponent },
];

After logging in, I have a white screen until I click on Dashboard Menu. My default Url goes to: https://localhost:44333/ Instead of https://localhost:44333/dashboard

I have checked other examples online and I cannot understand what is wrong with my router. Am I missing out something please?

1

There are 1 best solutions below

0
Antoniossss On

Why your dashboard has empty path specified { path: '', component: DashboardComponent} ?? Try

const routes: Routes = [
    { path: 'dashboard', component: DashboardComponent },
    { path: '**', redirectTo: 'dashboard' },
];