I have done jumping within the page before, which is relatively simple. Recently, the project needs to jump across pages and jump to the designated location. I have tried many methods, which are useful for passing parameters and then letting the page scroll the corresponding distance. However, once the length of the article changes, the scrolling distance also needs to be recalculated, which is quite troublesome. So finally, I summarized these two more reliable methods, just add the appropriate id to the place where it needs to jump. The principle is similar to jumping within a single page.
<p>You'll see which payment methods are available to you on the checkout page, before you submit a reservation request. After you select your country, all of your payment details will be shown.</p> <p >We charge featured guide who offer journey a 15% service fee. The amount of the service fee is calculated from the price that featured guide set for their journey. You will see the service fee when you set your price before submitting a journey. The service fee is automatically deducted from the payout to the Host. Depending on the laws of the jurisdiction involved, VAT may be charged on top of the service fee. The service fee will include these VAT charges when applicable.</p>
<button (click)="readMore()">ReadMore</button>
{ path: '',component: LoginComponent}, { path: 'detail', component: DetailComponent }, { path: '**',component: NotFoundComponent}
Method 1: Add a new routing address to implement it
{ path: '',component: LoginComponent}, { path: 'detail', component: DetailComponent }, { path: 'detail#readMore',component: NotFoundComponent}, { path: '**',component: NotFoundComponent}
readMore() { ('/detail#readMore'); }
ngOnInit() { if ( === '#readMore') { ('detail#readMore'); } }
Method 2: When the original route address remains unchanged, use the route to pass parameters to achieve
readMore() { (['/detail', { id: 'readMore'}]); } ( (data: any) => { if ( === 'readMore') { ('detail#readMore'); } } );
The above article Angular uses route to jump to the specified location of the specified page is all the content I share with you. I hope you can give you a reference and I hope you can support me more.