Angular routerLink does not navigate to the corresponding component

Discussão em 'Angular' iniciado por Jeff, Outubro 31, 2024.

  1. Jeff

    Jeff Guest

    My routing in the angular2 apps works well. But I am going to make some routeLink based on this:

    Here is my routing:

    const routes: RouterConfig = [
    { path:'home' , component: FormComponent },
    { path:'about', component: AboutComponent },
    { path:'**' , component: FormComponent }
    ];


    And here are the links that I made:

    <ul class="nav navbar-nav item">
    <li>
    <a routerLink='/home' routerLinkActive="active">Home</a>
    </li>
    <li>
    <a routerLink='/about' routerLinkActive="active">About this</a>
    </li>
    </ul>


    I expect that, when I click on them it navigates to the corresponding component, but they do not perform anything?

    Continue reading...

Compartilhe esta Página