-1

When I change the path to the correct routes in the url bar I get where I need to go and everything displays correctly. The actual router links are not taking me anywhere.

I have NgModule, Routes and RouterModule all imported properly in my only module. I have my components imported properly. router-outlet is properly placed. I have base href="/" in the head of my index.html.

Here is part of my html:

<section class="vertical-sidebar collapse navbar-collapse justify-content-end" id="navbarSidebarContent-main"
        [ngClass]="{'show':displaySideNav}">
        <nav class="nav">
            <ul class="sidebar-links">
                <li>
                    <a routerLink="/home">Home</a>
                </li>
                <li>
                    <a routerLink="/manage-sessions">Manage Sessions</a>
                </li>
                <li>
                    <a routerLink="/export-scancodes">Export ScanCodes</a>
                </li>
                <li>
                    <a routerLink="/imu-data">IMU Data</a>
                </li>
                <li>
                    <a routerLink="/global-order-days">Global Order Days</a>
                </li>
                <li>
                    <a routerLink="/order-exception-report">Order Exception Report</a>
                </li>
            </ul>
        </nav>
    </section>

I expect to be directed to the correct path when I click on the link. Nothing happens when I do so.

JCA
  • 197
  • 2
  • 2
  • 16

2 Answers2

1

Try as mentioned in docs

            <ul class="sidebar-links">
                <li>
                    <a routerLink="/home">Home</a>
                </li>
                ....
            </ul>
dota2pro
  • 7,220
  • 7
  • 44
  • 79
0

After a lot of trail and error yesterday I realized the issue came because a lot of the code had been given to me as boilerplate code that had been manually upgraded from Angular6 to 8. I created a new project in the cli from scratch and copied over my components and had no issues.

JCA
  • 197
  • 2
  • 2
  • 16