title: how to activate a current tab in angularjs bootstrap javascript
body: <p>I am trying the below code to activate the current tab selected but it is not working.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(document).ready(function(){
      $('a[data-toggle="tab"]').on('show.bs.tab', function(e) {
          localStorage.setItem('activeTab', $(e.target).attr('href'));
      });
      var activeTab = localStorage.getItem('activeTab');
      if(activeTab){
          $('#myTab a[href="' + activeTab + '"]').tab('show');
      }
  });
  &lt;/script&gt;
  &lt;div&gt;
      &lt;ul class="nav nav-pills " id="myTab"&gt;
          &lt;li class="active"&gt;&lt;a data-toggle="tab" href="#A"&gt; A&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a data-toggle="tab" href="#B"&gt; B&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a data-toggle="tab" href="#C"&gt; C&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>I guess, localStorage function in my code is not working properly . Can any one pleas guide me with the solution.  I am using Angularjs, Bootstrap.</p>