code: function removeTab (tabData) {
      if (destroyed) return;
      var selectedIndex = ctrl.selectedIndex,
          tab           = ctrl.tabs.splice(tabData.getIndex(), 1)[ 0 ];
      refreshIndex();
      // when removing a tab, if the selected index did not change, we have to manually trigger the
      //   tab select/deselect events
      if (ctrl.selectedIndex === selectedIndex) {
        tab.scope.deselect();
        ctrl.tabs[ ctrl.selectedIndex ] && ctrl.tabs[ ctrl.selectedIndex ].scope.select();
      }
      $mdUtil.nextTick(function () {
        updatePagination();
        ctrl.offsetLeft = fixOffset(ctrl.offsetLeft);
      });
    }
docs: Remove a tab from the data and select the nearest valid tab.
  @param {Object} tabData tab to remove