1
我有嵌套導航(路線)在我的例子如何防止父routerLink壓倒一切在孩子
<ul>
<li *ngFor="let route of routes" [routerLink]="route.link" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">
{{route.name}}</span>
<!-- Secondary navigation (if exists) -->
<ul *ngIf="route.children" class="secondary">
<li *ngFor="let item of route.children" [routerLink]="item.link" routerLinkActive="active" [routerLinkActiveOptions]="{exact: true}">
{{item.name}}
</li>
</ul>
</li>
</ul>
我每次點擊父項目,它定位到相應的鏈接,但在點擊其中任意一個子項,而不是相應的子鏈接,將定位於母公司<李>路由作爲整個兒<UL>是這個父<李> 我怎樣才能防止這種父routerLink在這種嵌套的情況下的一部分? Appriciate你的幫助。
如果您將'(click)=「$ event.stopPropagation()」'添加到內部函數,這是否工作? –
工作,謝謝 – SatAj