简体   繁体   English

AngularJS与Bootstrap选项卡冲突

[英]AngularJS conflicting with Bootstrap tabs

I'm using the JavaScript Bootstrap 3 tabs as documented, like this: 我正在使用JavaScript Bootstrap 3标签,如下所示:

<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
  <li class="active"><a href="#home" role="tab" data-toggle="tab">Home</a></li>
  <li><a href="#profile" role="tab" data-toggle="tab">Profile</a></li>
  <li><a href="#messages" role="tab" data-toggle="tab">Messages</a></li>
  <li><a href="#settings" role="tab" data-toggle="tab">Settings</a></li>
</ul>

<!-- Tab panes -->
<div class="tab-content">
  <div class="tab-pane active" id="home">...</div>
  <div class="tab-pane" id="profile">...</div>
  <div class="tab-pane" id="messages">...</div>
  <div class="tab-pane" id="settings">...</div>
</div>

But with Angular, it's changing the URL to /#/profile for instance.. 但是对于Angular,它正在将URL更改为/#/ profile。

How can I prevent this? 我怎么能阻止这个?

只需输入data-target而不是href属性,它就可以在不更改URL的情况下工作。

At one point, if a link had the _target attribute set, angular wouldn't intercept those clicks. 有一次,如果链接设置了_target属性,则angular不会拦截这些点击。 Perhaps that will work in this case? 也许这会在这种情况下起作用?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM