I work on web app done by angular 7
I need when click on any item on list on have router link on nvabar.component.html go to specified component on router link
without change URL .
navbar.component.html
- <div id="z2-2cols-leftpanel">
- <ul class="z2-leftpanel-ullinks">
- <li>
- <a routerLink="/overview" class="active z2tabBtn" data-z2tab="overview_content">
- <div class="z2iconfont icon-Basic-Info"></div>
- <div class="ulllinks-text">Overview</div>
- </a>
- </li>
- <li>
- <a routerLink="/family" class="z2tabBtn" data-z2tab="family_content">
- <div class="z2iconfont icon-Cross-Reference"></div>
- <div class="ulllinks-text">Family</div>
- </a>
- </li>
- <li>
- </ul>
- </div>
in app-routing.module.ts
- { path: 'overview', component: OverviewComponent },
- { path: 'family', component: FamilyComponent }
on overview.component.ts
- import { CompanyService } from './../../service/company.service';
- import { Component, OnInit } from '@angular/core';
- import { PartDetailsService } from 'src/app/service/part-details.service';
-
-
- @Component({
- selector: 'app-overview',
- templateUrl: './overview.component.html',
- styleUrls: ['./overview.component.css']
- })
- export class OverviewComponent implements OnInit {
-
- public companyProfile;
- constructor(public partDetailsService: PartDetailsService
- , public companyService: CompanyService) {
- }
-
- ngOnInit() {
- console.log("welcome overview component ");
- }
so I need when click on link overview on navbar.component.html
go to component overview and show welcome on console without change URL
so
How to do that please ?
current status is when click on link overview exist on navbar it go to overview component
but it change URL
what i need is when click overview link go to component overview but not change URL ?
Example
suppose i have URL localhost:4200/family
when click overview component go to overview component but not change URL to localhost:4200/overview meaning
link localhost:4200/family will be in URL although i click overview component and show message on console welcome overview