Skip to content
Loading
I need to access component when click link but not change UR  
in app-routing.module.ts
  1. { path: 'overview', component: OverviewComponent },  
  2. { path: 'family', component: FamilyComponent }  
on overview.component.ts
  1. import { CompanyService } from './../../service/company.service';  
  2. import { Component, OnInit } from '@angular/core';  
  3. import { PartDetailsService } from 'src/app/service/part-details.service';  
  4.   
  5.   
  6. @Component({  
  7. selector: 'app-overview',  
  8. templateUrl: './overview.component.html',  
  9. styleUrls: ['./overview.component.css']  
  10. })  
  11. export class OverviewComponent implements OnInit {  
  12.   
  13. public companyProfile;  
  14. constructor(public partDetailsService: PartDetailsService  
  15. public companyService: CompanyService) {  
  16. }  
  17.   
  18. ngOnInit() {  
  19. console.log("welcome overview component ");  
  20. }  
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

1 Reply

Know the answer? Post it — somebody with the same question will find it here.