forked from mgcrea/angular-strap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtab.demo.html
More file actions
214 lines (202 loc) · 7.35 KB
/
tab.demo.html
File metadata and controls
214 lines (202 loc) · 7.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<div class="bs-docs-section" ng-controller="TabDemoCtrl">
<div class="page-header">
<h1 id="tabs">Tabs <a class="small" href="//github.com/mgcrea/angular-strap/blob/master/src/tab/tab.js" target="_blank">tab.js</a>
</h1>
<code>mgcrea.ngStrap.tab</code>
</div>
<h2 id="tabs-examples">Examples</h2>
<p>Add quick, dynamic tab functionality to transition through panes of local content.</p>
<h3>Live demo <a class="small edit-plunkr" data-module-name="mgcrea.ngStrapDocs" data-content-html-url="tab/docs/tab.demo.html" data-content-js-url="tab/docs/tab.demo.js" ng-plunkr data-title="edit in plunker" data-placement="right" bs-tooltip>clog.info</a></h3>
<pre class="bs-example-scope">$scope.tabs = {{tabs | json}};
$scope.tabs.activeTab = "{{ tabs.activeTab }}";
</pre>
<div class="bs-example" append-source>
<div class="btn btn-default" ng-click="toggleThirdTab()">
{{ tabs[2].disabled ? 'Enable' : 'Disable' }} third tab
</div>
<div class="btn btn-default" ng-click="tabs.activeTab='Profile'">
Select "Profile" tab
</div>
<hr />
<!-- bsActivePane is optional -->
<div bs-active-pane="tabs.activeTab" bs-tabs>
<div ng-repeat="tab in tabs" data-title="{{ tab.title }}" name="{{ tab.title }}" disabled="{{ tab.disabled }}" ng-bind="tab.content" bs-pane>
</div>
</div>
</div>
<div class="bs-example" style="padding-bottom: 24px;" append-source>
<!-- control a tab with bsActivePane binding -->
<div class="btn-group" ng-model="tabs.activeTab" bs-radio-group>
<label class="btn btn-default" ng-repeat="tab in tabs">
<input type="radio" class="btn btn-default" value="{{ $index }}">Tab n°{{ $index + 1 }}
</label>
</div>
<div class="btn btn-default" ng-click="pushTab()">Add new tab</div>
</div>
<h2 id="tabs-usage">Usage</h2>
<p>Append a <code>bs-tabs</code> attribute to any element and several children <code>bs-pane</code> attributes to children elements to enable the directive.</p>
<div class="callout callout-warning">
<h4>ngModel binding</h4>
<p>Using <code>ngModel</code> to bind to the active tab pane index is deprecated and may be removed in future versions, due to issues with validation when using the Tabs directive inside a <code>form</code> element.</p>
<p>Please use the helper attribute <code>bsActivePane</code> instead.</p>
</div>
<div class="callout callout-info row">
<h4>Custom animations</h4>
<p>Pane animation is done with the <code>active</code> class and requires custom CSS. You can change the default <code>am-fade</code> animation class by including the <code>animation</code> option.</p>
<p>Here is a sample definition for the default <code>am-fade</code> animation class:</p>
<div class="col-md-5">
<p>LESS:</p>
<pre class="bs-exemple-code">
<code class="css" highlight-block>
.tab-pane.am-fade {
animation-duration: .3s;
animation-timing-function: ease;
animation-fill-mode: backwards;
opacity: 1;
&.active-remove {
display: none !important;
}
&.active-add {
animation-name: fadeIn;
}
}
</code>
</pre>
</div>
<div class="col-md-5 col-md-offset-1">
<p>CSS:</p>
<pre class="bs-exemple-code">
<code class="css" highlight-block>
.tab-pane.am-fade {
animation-duration: .3s;
animation-timing-function: ease;
animation-fill-mode: backwards;
opacity: 1;
}
.tab-pane.am-fade.active-remove {
display: none !important;
}
.tab-pane.am-fade.active-add {
animation-name: fadeIn;
}
</code>
</pre>
</div>
</div>
<h3>Options</h3>
<p>Options can be passed via data attributes or as an <a href="http://docs.angularjs.org/guide/expression">AngularJS expression</a> to evaluate as an object on
<code>bs-tabs</code> or <code>bs-pane</code>. For data attributes, append the option name to <code>data-</code>, as in <code>data-animation=""</code>.</p>
<div class="table-responsive">
<h4>bs-tabs options</h4>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 100px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>animation</td>
<td>string</td>
<td>am-fade</td>
<td>Apply a CSS animation to tab panes with <code>ngAnimate</code></td>
</tr>
<tr>
<td>template</td>
<td>path</td>
<td>false</td>
<td>
<p>If a remote URL is provided, overrides the default template</p>
</td>
</tr>
<tr>
<td>navClass</td>
<td>string</td>
<td>nav-tabs</td>
<td>
<p>Classes to be applied to the tab navigation (bootstrap supports <code>nav-pills</code>, <code>nav-stacked</code>)</p>
</td>
</tr>
<tr>
<td>activeClass</td>
<td>string</td>
<td>active</td>
<td>
<p>Class to be applied to the animated element</p>
</td>
</tr>
</tbody>
</table>
<h4>bs-pane options</h4>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 100px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>disabled</td>
<td>string</td>
<td>false</td>
<td>
<p>Disable pane</p>
</td>
</tr>
<tr>
<td>name</td>
<td>string</td>
<td>''</td>
<td>
<p>Tab name. If provided, it will be used for `bsActivePane` instead of number</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="callout callout-info">
<h4>Default options</h4>
<p>You can override global defaults for the plugin with <code>$tabProvider.defaults</code></p>
<div class="highlight">
<pre class="bs-exemple-code">
<code class="javascript" highlight-block>
angular.module('myApp')
.config(function($tabProvider) {
angular.extend($tabProvider.defaults, {
animation: 'am-flip-x'
});
})
</code>
</pre>
</div>
</div>
<h3>Helper attributes</h3>
<p>Helper attributes can be used together with the directive via data-attributes to support specific functionality. Helper attributes support data binding. To use helper attributes, append the helper attribute name to <code>data-</code>, as in <code>data-bs-active-pane="tabs.activeTab"</code>.</p>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 100px;">type</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>bsActivePane</td>
<td>number</td>
<td>
<p>Info about current selected tab. If it has the name, it will be here, otherwise – active tab pane index (zero based).</p>
<p>You can use it to set the active tab pane from code or to get the currently active tab pane.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>