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/

2
  • Can you make a JSFiddle that shows the error? Commented Oct 8, 2013 at 22:43
  • I try to get it run in jsfiddle without success: jsfiddle.net/jfn5z/84 Commented Oct 9, 2013 at 14:36

2 Answers 2

1

I hope this will help you

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

Sign up to request clarification or add additional context in comments.

2 Comments

this does not work. Close the south pane and open it again => tabs don't work anymore
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] (mgcrea.github.io/angular-strap/#/tab)
0

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

Or please make jsfiddle or pluncker .

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.