I am trying to have a navigation bar where when you click one of the subsections it will navigate you to a NEW page. As of now it when you click on one of the subsections in the nav that component is simply displayed under the existing component on the home page.
Here is my app.component.html
<nav class="navbar navbar-dark bg-dark">
<a class="navbar-brand" routerLink="#"><img class="navBarLogo" src="../../assets/whitelogo.png"></a>
<div class="navItemList">
<a class="navbar navItem" routerLink="/about">Home</a>
<a class="navbar navItem" routerLink="/about">About</a>
<a class="navbar navItem" routerLink="/about">Scheduling</a>
<a class="navbar navItem" routerLink="/about">Services</a>
</div>
</nav>
<router-outlet></router-outlet>
<app-home></app-home>
Here is my app-routing.module.ts
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AboutComponent } from './about/about.component'
import { CommonModule } from '@angular/common';
import { HomeComponent } from './home/home.component';
const routes: Routes = [
{path: 'home', component: HomeComponent },
{path: 'about', component: AboutComponent}
];
@NgModule({
imports: [CommonModule,
RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
For example, I want to display the AboutComponent on the page when "About" is clicked from the header. But when you click "About" right now what happens is it displays the HomeComponent and under that the AboutComponent.