1

I use jQuery layout plugin. 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.

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:
        '<div class="tabbable">' +
        '<ul class="nav nav-tabs">' +
        '<li ng-repeat="tabpane in tabpanes" ng-class="{active:tabpane.selected}">' +
        '<a href="" ng-click="select(tabpane)">{{tabpane.title}}</a>' +
        '</li>' +
        '</ul>' +
        '<div class="tab-content" ng-transclude></div>' +
        '</div>',
        replace: true
    };
}).
directive('tabpane', function () {
    return {
        require: '^tabs',
        restrict: 'E',
        transclude: true,
        scope: { title: '@' },
        link: function (scope, element, attrs, tabsCtrl) {
            tabsCtrl.addTabPane(scope);
        },
        template:
        '<div class="tab-pane" ng-class="{active: selected}" ng-transclude>' +
        '</div>',
        replace: true
    };
})

jsfiddle: http://jsfiddle.net/jfn5z/84/

daniel
  • 34,281
  • 39
  • 104
  • 158

2 Answers2

1

I hope this will help you

Working ==> fiddle http://jsfiddle.net/Nishchit14/jfn5z/85/

Nishchit
  • 18,284
  • 12
  • 54
  • 81
  • this does not work. Close the south pane and open it again => tabs don't work anymore – daniel Oct 10 '13 at 09:57
  • First of all sorry for my miss understanding , it seems like layout plugin changes 'active' class on ( .tab-content.pane-tab). Please check this if it will help [tab] (http://mgcrea.github.io/angular-strap/#/tab) – Nishchit Oct 10 '13 at 11:11
0

Why not you use angular-ui-bootstrap or angular-strap

Or please make jsfiddle or pluncker .

Nishchit
  • 18,284
  • 12
  • 54
  • 81