TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ahmed elbarbary
NA
1.6k
278.4k
I need to access component when click link but not change UR
Dec 20 2019 8:04 PM
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
Reply
Answers (
1
)
typescript increases value for any datatype using pipe (|)
How to get id of part name searched on textbox then add to u