gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 01:54:55 25 4
gpt4 key购买 nike

我使用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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com