/
index-angular.html
118 lines (106 loc) · 3.91 KB
/
index-angular.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
<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Stackable AngularJs</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
</head>
<body>
<div class="container" ng-controller="MainController">
<h3>Containers:</h3>
<ul>
<li ng-repeat="container in containers">
{{container.name}}
</li>
</ul>
<hr />
<h3>Single Container:</h3>
<ul>
<li>
{{singleContainer.name}}
</li>
</ul>
<hr />
<h3>Single Container Items:</h3>
<ul>
<li ng-repeat="item in singleContainerItems">
{{ item.data | debug }}
</li>
</ul>
<hr />
<h3>All Stack Items:</h3>
<ul>
<li ng-repeat="item in allItems">
{{ item.data | debug }}
</li>
</ul>
<hr />
<h3>Single Item:</h3>
<ul>
<li>
{{ singleItem.data | debug }}
</li>
</ul>
<hr />
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script src="../dist/stackable-bower.min.js"></script>
<script type="application/javascript">
angular.module('myApp', [])
.controller('MainController', ['$scope', function($scope) {
var stackable = new Stackable('BPGhLf9D9FEM');
stackable.getContainers(function (error, result) {
//console.log(error, result);
if (!error) {
$scope.$apply(function () {
$scope.containers = result.data;
});
}
});
stackable.getContainer('SamPnREY7zjq6i4od', function (error, result) {
//console.log(error, result);
if (!error) {
$scope.$apply(function () {
$scope.singleContainer = result.data[0];
});
}
});
stackable.getContainerItems('SamPnREY7zjq6i4od', function (error, result) {
//console.log(error, result);
if (!error) {
$scope.$apply(function () {
$scope.singleContainerItems = result.data;
});
}
});
stackable.getAllItems(function (error, result) {
//console.log(error, result);
if (!error) {
$scope.$apply(function () {
$scope.allItems = result.data;
});
}
});
stackable.getItem('dZmr4nw6h4jyqDB7c', function (error, result) {
//console.log(error, result);
if (!error) {
$scope.$apply(function () {
$scope.singleItem = result.data[0];
});
}
});
}])
.filter('debug', function() {
return function(input) {
if (input === '') return 'empty string';
return input ? input : ('' + input);
};
});
</script>
</body>
</html>