I am using A6 router in where I am rendering 3 components on /new route. I am also using Angular-material and using the sidenav component. My parentComponent is the main content area and the childComponent is the drawer content.
{
path: 'new',
children: [
{
path: '',
component: ParentComponent
},
{
path: '',
component: SiblingComponent,
outlet: 'nav',
children: [
{
path: '',
component: ChildComponent
}
]
}
]
}
childComponent html
<div class="new-event-side-nav">
<mat-nav-list>
<a mat-list-item>
<span>Some Details</span>
</a>
<a mat-list-item [href]="otherDetail">
<span>Other Details</span>
</a>
</mat-nav-list>
</div>
parentComponent
<mat-card>
<div id="some_detail">
<p>Some Content</p>
</div>
<div id="other_detail">
<p>Other Content</p>
</div>
</mat-card>
I can extract the IDs of both divs in my child component using
otherDetail = document.getElementById('other_detail');
and inject it into my child component's html. But on click it's not scrolling down to the element, I'm getting a 404. Further more, my url changes from /new to /%5Bobject%20HTMLDivElement%5D
I'm new to scrolling to elements in Angular 6. Anyone have experience with scrolling to different elements using a sidenav from a child element?