1

I, have the below route

{
        path: '', component: FrontEndMainComponent,
        children: [
            { path: '', redirectTo: 'home', pathMatch: 'full' },
            { path: 'home', component: FrontEndHomeComponent },
            { path: 'login', component: CustomerAuthComponent }
        ]
    },

When I, tried to navigate to login or home from login it gives me an error as shown below.

erro description

error details

Here is the html code for navigation

<mat-toolbar color="primary" class="example-toolbar">
            <a  [routerLink]="['home']"><img src="../../assets/logo.png"/></a>
            <div>
                  <a mat-raised-button color="primary" [routerLink]="['login']">Login</a>&nbsp;&nbsp;
                  <a mat-raised-button color="primary" [routerLink]="['signup']">Sign up</a>

            </div>

      </mat-toolbar>

some of the link I checked https://www.concretepage.com/angular-2/angular-2-4-child-routes-and-relative-navigation-example

How do I navigate to a parent route from a child route?

San Jaisy
  • 15,327
  • 34
  • 171
  • 290

1 Answers1

-1

Try with the following, you should add a /

<a  [routerLink]="['/home']"><img src="../../assets/logo.png"/></a>
Sajeetharan
  • 216,225
  • 63
  • 350
  • 396