Published in : 2022-03-01
I am working on an Angular 10 project, where I am not using location hash strategy as I want to use HTML anchor tag with #idref concept. So my ng serve link is containing path like, //localhost:4500/dashboard/wallet.
<li routerLinkActive="active"> <a [routerLink]="['/dashboard/wallet']">Wallet</a> <ul > <li> <a href="#depoWallet">Deposit Wallet</a> </li> <li> <a href="#withdrawalWallet">Withdrawal Wallet</a> </li> <li> <a href="#trnWallet">Transaction</a> </li> </ul></li>
When I click on Deposit wallet, it should scroll down to bottom where I put id = “depoWallet”; But it is not working anymore!
I went through with this git thread, which should solve the issue using below line,
<a [routerLink]="['/dashboard/wallet/']" fragment="depoWallet" >Deposit Wallet</a>
When I click the anchor tag, It appends #depoWallet at the end of the URL but it doesn't scroll to the top of the browser.
Does anyone know the proper solution?
Join our community and get the chance to solve your code issues & share your opinion with usSign up Now