title: Ask to confirm when changing tabs in angular bootstrap
body: <p>I have tabs with forms and I want ask the user to confirm or discard their changes when changing tabs. My current code works</p>
  
  <p><code>&lt;uib-tab heading="..." index="3" deselect="main.onDeselect($event)" ... &gt;</code></p>
  
  <pre><code>this.onDeselect = function($event) {
      if(...isDirty...) {         
          if($window.confirm("Do you want to discard?")) {
              ... discard (and go to new tab) ...
          } else {
              $event.preventDefault(); //stays on current tab
          }
      }
  }
  </code></pre>
  
  <p>The problem is I want to change confirm to javascript dialog and I will get result in callback.</p>
  
  <p>I planed to <code>preventDefault()</code> all and then switch manually, but I cannot figure out where to get new tab id.</p>
  
  <p>Any solution is appreciated. Even if it is easier in other tab implementations.</p>
  
  <p>I use AngularJS v1.4.7, ui-bootstrap-tpls-1.3.3.min.js</p>