title: jQuery Layout Plugin + AngularJS Tabs
body: <p>I use <a href="http://layout.jquery-dev.net/" rel="nofollow">jQuery layout plugin</a>. Inside a pane I use tabs created by angularjs (code below). When I close the layout pane (south pane in the jsfiddle) and open it again, the tabs don't work anymore. Resizing doesn't cause this problem.</p>
  
  <pre><code>directive('tabs', function () {
      return {
          restrict: 'E',
          transclude: true,
          scope: {},
          controller: function ($scope, $element) {
              var tabpanes = $scope.tabpanes = [];
  
              $scope.select = function (tabpane) {
                  angular.forEach(tabpanes, function (tabpane) {
                      tabpane.selected = false;
                  });
                  tabpane.selected = true;
              }
  
      this.addTabPane = function (tabpane) {
                  if (tabpanes.length == 0) $scope.select(tabpane);
                  tabpanes.push(tabpane);
              }
    },
          template:
          '&lt;div class="tabbable"&gt;' +
          '&lt;ul class="nav nav-tabs"&gt;' +
          '&lt;li ng-repeat="tabpane in tabpanes" ng-class="{active:tabpane.selected}"&gt;' +
          '&lt;a href="" ng-click="select(tabpane)"&gt;{{tabpane.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('tabpane', function () {
      return {
          require: '^tabs',
          restrict: 'E',
          transclude: true,
          scope: { title: '@' },
          link: function (scope, element, attrs, tabsCtrl) {
              tabsCtrl.addTabPane(scope);
          },
          template:
          '&lt;div class="tab-pane" ng-class="{active: selected}" ng-transclude&gt;' +
          '&lt;/div&gt;',
          replace: true
      };
  })
  </code></pre>
  
  <p>jsfiddle: <a href="http://jsfiddle.net/jfn5z/84/" rel="nofollow">http://jsfiddle.net/jfn5z/84/</a></p>