Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS conflicting with Bootstrap tabs

I'm using the JavaScript Bootstrap 3 tabs as documented, like this:

<!-- 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..

How can I prevent this?

like image 711
Billy Assim Avatar asked Sep 28 '14 00:09

Billy Assim


2 Answers

Just put data-target instead of href attribute and it will work without changing urls.

like image 81
mgalic Avatar answered Nov 10 '22 03:11

mgalic


At one point, if a link had the _target attribute set, angular wouldn't intercept those clicks. Perhaps that will work in this case?

like image 44
Blaskovicz Avatar answered Nov 10 '22 04:11

Blaskovicz