Tabs

案例

<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href='../node_modules/bootstrap/dist/css/bootstrap.css'>
<link rel="stylesheet" href='../node_modules/angular-ui-bootstrap/dist/ui-bootstrap-csp.css'>
<script src="../node_modules/angular/angular.min.js"></script>
<script src="../node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js"></script>
<style type="text/css">
form.tab-form-demo .tab-pane {
margin: 20px 20px;
}
</style>
<script>
angular.module('myApp',['ui.bootstrap'])
.controller('TabsDemoCtrl', function ($scope, uibDateParser) {
$scope.tabs = [
{ title:'Dynamic Title 1', content:'Dynamic content 1' },
{ title:'Dynamic Title 2', content:'Dynamic content 2', disabled: true }
]; $scope.alertMe = function() {
setTimeout(function() {
$window.alert('You\'ve selected the alert tab!');
});
}; $scope.model = {
name: 'Tabs'
};
});
</script>
</head>
<body>
<div ng-controller="TabsDemoCtrl">
<p>Select a tab by setting active binding to true:</p>
<p>
<button type="button" class="btn btn-default btn-sm" ng-click="active = 1">Select second tab</button>
<button type="button" class="btn btn-default btn-sm" ng-click="active = 2">Select third tab</button>
</p>
<p>
<button type="button" class="btn btn-default btn-sm" ng-click="tabs[1].disabled = ! tabs[1].disabled">Enable / Disable third tab</button>
</p>
<hr /> <uib-tabset active="active">
<uib-tab index="0" heading="Static title">Static content</uib-tab>
<uib-tab index="$index + 1" ng-repeat="tab in tabs" heading="{{tab.title}}" disable="tab.disabled">
{{tab.content}}
</uib-tab>
<uib-tab index="3" select="alertMe()">
<uib-tab-heading>
<i class="glyphicon glyphicon-bell"></i> Alert!
</uib-tab-heading>
I've got an HTML heading, and a select callback. Pretty cool!
</uib-tab>
</uib-tabset> <hr /> <uib-tabset active="activePill" vertical="true" type="pills">
<uib-tab index="0" heading="Vertical 1">Vertical content 1</uib-tab>
<uib-tab index="1" heading="Vertical 2">Vertical content 2</uib-tab>
</uib-tabset> <hr /> <uib-tabset active="activeJustified" justified="true">
<uib-tab index="0" heading="Justified">Justified content</uib-tab>
<uib-tab index="1" heading="SJ">Short Labeled Justified content</uib-tab>
<uib-tab index="2" heading="Long Justified">Long Labeled Justified content</uib-tab>
</uib-tabset> <hr /> Tabbed pills with CSS classes
<uib-tabset type="pills">
<uib-tab heading="Default Size">Tab 1 content</uib-tab>
<uib-tab heading="Small Button" classes="btn-sm">Tab 2 content</uib-tab>
</uib-tabset> <hr /> Tabs using nested forms:
<form name="outerForm" class="tab-form-demo">
<uib-tabset active="activeForm">
<uib-tab index="0" heading="Form Tab">
<ng-form name="nestedForm">
<div class="form-group">
<label>Name</label>
<input type="text" class="form-control" required ng-model="model.name"/>
</div>
</ng-form>
</uib-tab>
<uib-tab index="1" heading="Tab One">
Some Tab Content
</uib-tab>
<uib-tab index="2" heading="Tab Two">
More Tab Content
</uib-tab>
</uib-tabset>
</form>
Model:
<pre>{{ model | json }}</pre>
Nested Form:
<pre>{{ outerForm.nestedForm | json }}</pre>
</div>
</body>
</html>

效果

uib-tabset 配置

  • active  (Default: Index of first tab) - 选项卡索引。设置这个现有选项卡的标签索引。

    <button type="button" class="btn btn-default btn-sm" ng-click="uibTabDemo = 1">点击后切换到two</button>
    <uib-tabset active="uibTabDemo">
    <uib-tab index="0" heading="one">
    one
    </uib-tab>
    <uib-tab index="1" heading="two">
    two
    </uib-tab>
    </uib-tabset>

  • justified $ (Default: false) -标签填补容器的宽度受否一致。

    <uib-tabset active="activeJustified" justified="true">
    <uib-tab index="0" heading="Justified">Justified content</uib-tab>
    <uib-tab index="1" heading="SJ">Short Labeled Justified content</uib-tab>
    <uib-tab index="2" heading="Long Justified">Long Labeled Justified content</uib-tab>
    <uib-tab index="3" heading="Long ">Long Labeled content</uib-tab>
    <uib-tab index="4" heading="Justified">Justified content</uib-tab>
    </uib-tabset>

    <uib-tabset active="activeJustified" justified="false">
    <uib-tab index="0" heading="Justified">Justified content</uib-tab>
    <uib-tab index="1" heading="SJ">Short Labeled Justified content</uib-tab>
    <uib-tab index="2" heading="Long Justified">Long Labeled Justified content</uib-tab>
    <uib-tab index="3" heading="Long ">Long Labeled content</uib-tab>
    <uib-tab index="4" heading="Justified">Justified content</uib-tab>
    </uib-tabset>

    • template-url (Default: uib/template/tabs/tabset.html) - 一个URL代表组件使用的模板位置。
  • type (Defaults: tabs) - 导航类型。可能的值是“tabs”和“pills”。以下是pills类型

    <uib-tabset type="pills">
    <uib-tab heading="Default Size">Tab 1 content</uib-tab>
    <uib-tab heading="Small Button" classes="btn-sm">Tab 2 content</uib-tab>
    </uib-tabset>

  • vertical $ (Default: false) - 标签是否垂直堆叠显示(最好设置type为pills,因为ui-bootstrap并没有对对垂直显示做样式调整)。

    <uib-tabset active="activePill" vertical="true" type="pills">
    <uib-tab index="0" heading="Vertical 1">Vertical content 1</uib-tab>
    <uib-tab index="1" heading="Vertical 2">Vertical content 2</uib-tab>
    </uib-tabset>

uib-tab 配置

  • classes $ - 一个可选的字符串,内容为空格分隔的CSS类.这个类是作用到标签上的,而不是内容上的

    Tabbed pills with CSS classes
    <uib-tabset type="pills">
    <uib-tab heading="Default Size">Tab 1 content</uib-tab>
    <uib-tab heading="Small Button" classes="btn-sm">Tab 2 content</uib-tab>
    </uib-tabset>

  • deselect() $ - 当标签被激活时,一个可选的表达式

  • disable $  (Default: false) - 禁用选项卡

  • heading - 标题文本

    <uib-tabset>
    <uib-tab index="0" heading="one">
    one
    </uib-tab>
    <uib-tab index="1" heading="two">
    two
    </uib-tab>
    </uib-tabset>

  • index - 标签索引。必须是唯一的数字或字符串。

  • select() $ - 一个可选的表达式,当标签被激活时触发。

    $scope.tabs = [
    { title:'Dynamic Title 1', content:'Dynamic content 1' },
    { title:'Dynamic Title 2', content:'Dynamic content 2', disabled: true }
    ]; $scope.alertMe = function() {
    console.log('demo')
    };

  • template-url (Default: uib/template/tabs/tab.html) - 一个URL的位置代表使用选项卡标题的模板。

Tabset heading

如果使用uib-tabset字符串标题无法满足需求,您也可以使用一个uib-tab-heading元素。也可以使用HTML。

<uib-tabset active="active">
<uib-tab index="0" heading="Static title">Static content</uib-tab>
<uib-tab index="1" select="alertMe()">
<uib-tab-heading>
<i class="glyphicon glyphicon-bell"></i> Alert!
</uib-tab-heading>
I've got an HTML heading, and a select callback. Pretty cool!
</uib-tab>
</uib-tabset>

已知的问题

要在标签中使用可点击元素(例如a标签),你必须改为使用div元素,而不是a元素,并设置相应的样式。

angular-ui-bootstrap插件API - Tabs的更多相关文章

  1. Angular -ui - BootStrap组件的解释以及使用

    关于UI BootStrap UI BootStrap 是angularUI团队用纯粹angularJS语法编写的Bootstrap组件. 1. 关于ng-router(angular-router. ...

  2. jquery ui bootstrap日期插件

    http://blog.csdn.net/php_897721669/article/details/7404527 搜索“jquery ui日期插件怎么显示年份”? $("#datepic ...

  3. Angular.js+Bootstrap实现手风琴菜单

    说是Angular.js+Bootstrap实现手风琴菜单,其实就是用了Bootstrap的样式而已. 上一篇实现了表格+分页,接着学习实现的Demo. 主要练习自定义指令,向指令中传递参数,老规矩先 ...

  4. Bootstrap插件概述

    前面的话 Bootstrap除了包含丰富的Web组件之外,如下拉菜单.按钮组.导航.分页等,还包括一些JavaScript的插件.插件为 Bootstrap 的组件赋予了“生命”.Bootstrap的 ...

  5. 20个超棒的jQuery bootstrap 插件

    1. Bootstrap File Input Bootstrap3.x 的一个增强版的HTML 5 文件选择控件,可以对图片文件和文本文件进行预览,以及其他功能.该插件增强了这些插件,并且将组件的初 ...

  6. Bootstrap插件的使用

    昨天,我偶然间发现了它——BootStrap插件,它是一一套功能强大的前端组件.说起来,我跟这插件还真算得上有缘,我本来并不是去找这个插件的,我本来是找BootStarp Paginator这个分页插 ...

  7. angular-ui-bootstrap插件API - Pagination

    Pagination: 案例 <!DOCTYPE html> <html lang="en" ng-app="myApp"> <h ...

  8. angular-ui-bootstrap插件API - Pager

    Pager: 案例 <!DOCTYPE html> <html lang="en" ng-app="myApp"> <head&g ...

  9. Android视频编辑SDK--RDVECore来自锐动的无UI,高度抽象化API

    1 RDVECore功能概述 RDVECore是锐动推出的无UI,高度抽象化API的视频编辑SDK,支持以下功能: 1.1 丰富的编辑功能 RDVECore包含了丰富的基础功能,对于编辑中的视频.图片 ...

随机推荐

  1. js理解

    js-提前声明和new操作符理解   1.提前声明:声明变量后,js会把声明部分提前到作用域前面. var a=1; function aheadOfStatement(){ alert(a); va ...

  2. MVC使用RDL报表

    MVC使用RDL报表 这次我们来演示MVC3怎么显示RDL报表,坑爹的微软把MVC升级到5都木有良好的支持报表,让MVC在某些领域趋于短板 我们只能通过一些方式来使用rdl报表. Razor视图不支持 ...

  3. url路径

      /:表示根目录(最原始开头的那个目录): ~/:表示虚拟站点根目录: ../:表示上级目录(当前目录的上一级),相当于在当前目录按了一次后退键: ../../:表示上上级目录: ./:当前目录(当 ...

  4. P2P中的NAT穿越方案简介

    文章链接: http://www.shipin.it/Index/videolist/id/68.html

  5. [转]Data Structure Recovery using PIN and PyGraphviz

    Source:http://v0ids3curity.blogspot.com/2015/04/data-structure-recovery-using-pin-and.html --------- ...

  6. revel框架教程之CSRF(跨站请求伪造)保护

    revel框架教程之CSRF(跨站请求伪造)保护 CSRF是什么?请看这篇博文“浅谈CSRF攻击方式”,说的非常清楚. 现在做网站敢不防CSRF的我猜只有两种情况,一是没什么人访问,二是局域网应用.山 ...

  7. picker控件详解与使用,(实现省市的二级联动)

    picker控件详解与使用,(实现省市的二级联动) 第一步:新建一个单视图(single view)的工程, 命名为pickerTest,不要勾选下面两个选项,第一个是新版本里面的,第二个是单元测试, ...

  8. 配置 SQL Server Email 发送以及 Job 的 Notification通知功能

    配置 SQL Server Email 发送以及 Job 的 Notification通知功能 在与数据库相关的项目中, 比如像数据库维护, 性能警报, 程序出错警报或通知都会使用到在 SQL Ser ...

  9. 发布Activex全过程

    C#制作.打包.签名.发布Activex全过程 一.前言 最近有这样一个需求,需要在网页上面启动客户端的软件,软件之间的通信.调用,单单依靠HTML是无法实现了,因此必须借用Activex来实现.由于 ...

  10. SQLsever2008 远程连接错误 linq

    如果你也和我一样远程连接一个sqlsever2008数据时出现类似错误 SqlException (0x80131904): 用户 ‘xxxxx' 登录失败. 首先在“服务器资源管理器”中测试一下你的 ...