-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
167 lines (149 loc) · 4.68 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<!--dependencies start -->
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.0/css/bootstrap.css" rel="stylesheet">
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.js"></script>
<!--dependencies end -->
<link href="dist/ez-tabs.min.css" rel="stylesheet"/>
<script src="src/ez-tabs.js"></script>
<script>
angular.module('myApp', ['ez.tabs'])
.controller('AppCtrl', ['$scope', '$interval', '$q', function AppCtrl($scope, $interval, $q) {
$scope.likes = 10;
$scope.config = {
preSelectPromise: function(tab) {
var deferred = $q.defer();
console.log(tab);
setTimeout(function() {
if (confirm('Are you sure?')) {
deferred.resolve();
} else {
deferred.reject();
}
}, 100);
return deferred.promise;
}
};
$scope.toggleTab4 = function() {
$scope.showTab4 = !$scope.showTab4;
};
$scope.tab2Heading = 'Tab 2';
$interval(function() {
$scope.likes++;
}, 100);
}])
.controller('FormCtrl', ['$scope', function($scope) {
$scope.form = {
name: 'Test',
description: 'What what!',
};
}])
;
</script>
</head>
<body ng-app="myApp">
<div ng-controller="AppCtrl" class="container">
<div class="page-header">
<h1>ez-tabs</h1>
</div>
<div class="page-body">
<tabset>
<tab>
<tab-heading>Tab 1</tab-heading>
<tab-content>Transcluded variables bind of course. Likes: {{ likes }}</tab-content>
</tab>
<tab>
<tab-heading>{{ tab2Heading }}</tab-heading>
<tab-content>
Tab 2 Heading: <input type="text" ng-model="tab2Heading"/>
</tab-content>
</tab>
<tab>
<tab-heading>Tab 3</tab-heading>
<tab-content>
<button ng-click="toggleTab4()">Toggle Tab 4</button>
</tab-content>
</tab>
<tab ng-if="showTab4">
<tab-heading>Tab 4</tab-heading>
<tab-content>More content</tab-content>
</tab>
<tab>
<tab-heading>Tab 5</tab-heading>
<tab-content>5 content</tab-content>
</tab>
</tabset>
<br>
<h3>Left Tabs <small>With some custom css</small></h3>
<hr>
<br>
<tabset class="tabs-left">
<tab>
<tab-heading>Tab 1</tab-heading>
<tab-content>
<form name="_form" ng-controller="FormCtrl">
<table>
<tr>
<td><label>Name</label></td>
<td><input type="text" ng-model="form.name"/></td>
</tr>
<tr>
<td><label>Description</label></td>
<td><textarea ng-model="form.description"></textarea></td>
</tr>
</table>
</form>
</tab-content>
</tab>
<tab>
<tab-heading>Tab 2</tab-heading>
<tab-content>
<form name="_form" ng-controller="FormCtrl">
<table>
<tr>
<td><label>Name2</label></td>
<td><input type="text" ng-model="form.name"/></td>
</tr>
<tr>
<td><label>Description2</label></td>
<td><textarea ng-model="form.description"></textarea></td>
</tr>
</table>
</form>
</tab-content>
</tab>
<tab>
<tab-heading>Tab 3</tab-heading>
<tab-content>More content 3</tab-content>
</tab>
</tabset>
<br>
<h3>Right Tabs <small>With selection control flow, without lazy load</small></h3>
<hr>
<br>
<tabset class="tabs-right" config="config" lazy="false">
<tab>
<tab-heading>Tab 1</tab-heading>
<tab-content src="custom.html"></tab-content>
</tab>
<tab>
<tab-heading>Tab 2</tab-heading>
<tab-content>More content 2</tab-content>
</tab>
<tab>
<tab-heading>Tab 3</tab-heading>
<tab-content src="custom2.html"></tab-content>
</tab>
</tabset>
<script id="custom.html" type="text/ng-template">
<p>I was loaded from a custom template - {{ likes }}</p>
</script>
<script id="custom2.html" type="text/ng-template">
<p>I was loaded from a custom template 2 - {{ likes }}</p>
</script>
</div>
</div>
</body>
</html>