Each time I am clicking on the a tag the browser opens a new window. How to prevent this kind of behavior? I have also tried to put write an href #a
instead of the data-target but it's not collapsing. (with data-target it is collapsing on the new window)
This is my code:
<nav>
<ul>
<li routerLinkActive="active">
<a data-target=#a data-toggle="collapse" routerLink="device-tools" aria-
expanded="false"><i class="fa fa-cogs" aria-hidden="true"></i>Device tools</a>
<ul class="collapse list-unstyled" id="a">
<li routerLinkActive="active"><a routerLink="protocol-group">Protocol group</a></li>
<li routerLinkActive="active"><a routerLink="protocol">Protocol</a></li>
</ul>
</li>
</ul>
</nav>
删除此行data-target=#a
In my case what I have done was to wrap the router link with another href :
<a href="#" data-toggle="collapse" data-target="#one">
<a [routerLink]='["/"]' (click)='collapse()'>Home</a>
</a>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.