所以我试图以角度路线导航到同一页面中的元素 但它不起作用,它将我引向了另一条路线
<h2>Food</h2>
<ul class="list-group">
<li class="list-group-item"><a href="#pizzas">Pizzas</a></li>
<li class="list-group-item">Dapibus ac facilisis in</li>
<li class="list-group-item">Morbi leo risus</li>
<li class="list-group-item">Porta ac consectetur ac</li>
<li class="list-group-item">Vestibulum at eros</li>
</ul>
<div class="category1 mt-3">
<h3 id="pizzas">Pizzas</h3>
怎么做
答案 0 :(得分:0)
您可以使用NavigationExtras official docs here
或者像这样:
<li class="list-group-item"><a [routerLink]="['/your-route']" fragment="pizzas">Pizzas</a></li>