javascript - jQuery 布局插件 + AngularJS 选项卡

标签 javascript angularjs jquery-plugins jquery-layout

我使用jQuery layout plugin 。在 Pane 内,我使用 angularjs 创建的选项卡(代码如下)。当我关闭布局 Pane (jsfiddle 中的南 Pane )并再次打开它时,选项卡不再工作。调整大小不会导致此问题。

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/

最佳答案

希望这对你有帮助

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

关于javascript - jQuery 布局插件 + AngularJS 选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19259586/

相关文章:

php - PHP Regex在(xxx)xxx-xxxx上

javascript - angular-bootstrap typeahead 使用 $http

当直接转到 URL 时,AngularJS 路由路径中的参数不会以 HTML5 模式加载

android - iphone 和 android 中使用 phonegap 的闹钟应用程序

Jquery Plugin easySlider 1.7 - 如何在 easySlider 中创建交叉淡入淡出效果?

javascript - 在 FullCalendar 插件上创建重复事件

javascript - 带悬垂的jquery滑动抽屉

javascript - 将数据导入 HTML 文件中的脚本的最简单方法

javascript - Array.slice() 参数不是函数

java - 无法为JAX-B生成架构,仅在CORS调用REST服务期间发生