title: How to change Selected Tab inside controller in angularjs?
body: <p>Here I created <a href="http://plnkr.co/edit/EhRHkJZZyczMKI00A5aJ?p=preview" rel="nofollow">Sample For Tabs</a>. </p>
  
  <p>What I exactly need is inside sample controller manually I need to set selected tab based on config parameter. At load time  I need to set manually the tab to be selected(Based on tabid is also fine). I need this functionality inside controller.can any one help me on this</p>
  
  <pre><code>angular.module('components', []).
    directive('tabs', function() {
      return {
        restrict: 'E',
        transclude: true,
        scope: {},
        controller: [ "$scope", function($scope) {
          var panes = $scope.panes = [];
  
          $scope.select = function(pane) {
            angular.forEach(panes, function(pane) {
              pane.selected = false;
            });
            pane.selected = true;
          }
  
          this.addPane = function(pane) {
            if (panes.length == 0) $scope.select(pane);
            panes.push(pane);
          }
        }],
        template:
          '&lt;div class="tabbable"&gt;' +
            '&lt;ul class="nav nav-tabs"&gt;' +
              '&lt;li ng-repeat="pane in panes" ng-class="{active:pane.selected}"&gt;'+
                '&lt;a href="" ng-click="select(pane)"&gt;{{pane.title}}&lt;/a&gt;' +
              '&lt;/li&gt;' +
            '&lt;/ul&gt;' +
            '&lt;div class="tab-content" ng-transclude&gt;&lt;/div&gt;' +
          '&lt;/div&gt;',
        replace: true
      };
    }).
    directive('pane', function() {
      return {
        require: '^tabs',
        restrict: 'E',
        transclude: true,
        scope: { title: '@' },
        link: function(scope, element, attrs, tabsCtrl) {
          tabsCtrl.addPane(scope);
        },
        template:
          '&lt;div class="tab-pane" ng-class="{active: selected}" ng-transclude&gt;' +
          '&lt;/div&gt;',
        replace: true
      };
    })
    .controller('sample', function($scope){
        //Here I need to Change Selected Tab
    })
  </code></pre>