forked from stemlabs/angular-people
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathversiontwoscripts.html
More file actions
141 lines (126 loc) · 6.66 KB
/
versiontwoscripts.html
File metadata and controls
141 lines (126 loc) · 6.66 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
<!DOCTYPE html>
<html ng-app="demoApp">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.js"></script>
<script src="https://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.11.0.js"></script>
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" data-require="bootstrap-css@3.1.1" data-semver="3.1.1" />
</head>
<body ng-controller="demoController">
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Contact Cards</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<div>
<pre>{{ascending}} {{ directionalSort }}</pre>
<div class="btn-group">
<label class="btn btn-primary" ng-model="sortField" ng-click="ascending[0] = !ascending[0]; currentColumn = 0" btn-radio="'address1'">
City
<i class="glyphicon" ng-class="{'glyphicon-chevron-down': !ascending[0], 'glyphicon-chevron-up': ascending[0]}"></i>
</label>
<label class="btn btn-primary" ng-model="sortField" ng-click="ascending[1] = !ascending[1]; currentColumn = 1" btn-radio="'firstname'">
First Name
<i class="glyphicon" ng-class="{'glyphicon-chevron-down': !ascending[1], 'glyphicon-chevron-up': ascending[1]}"></i>
</label>
<label class="btn btn-primary" ng-model="sortField" ng-click="ascending[2] = !ascending[2]; currentColumn = 2" btn-radio="'lastname'">
Last Name
<i class="glyphicon" ng-class="{'glyphicon-chevron-down': !ascending[2], 'glyphicon-chevron-up': ascending[2]}"></i>
</label>
</div>
</div>
</ul>
<form class="navbar-form navbar-right" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search" ng-model="searchText">
</div>
</form>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<p>This lesson shows the use of the Angular Cloud Data Connector. It loads property information from Windows Azure Mobile Services.</p>
<div ng-container>
<div class="row">
<div ng-repeat="person in people | filter:searchText | orderBy:directionalSort">
<div class="col-sm-6 col-md-4 col-lg-2">
<div class="panel panel-default">
<div class="panel-heading">{{ person.firstname }} {{ person.lastname }}</div>
<div class="panel-body">{{ person.address1 }}</div>
</div>
</div>
</div>
</div>
</div>
<div class="well form-horizontal">
<legend>Add Person</legend>
<input type="text" ng-model='newPerson.firstname' class="form-control" placeholder="First Name" />
<input type="text" ng-model='newPerson.lastname' class="form-control" placeholder="Last Name" />
<input type="text" ng-model='newPerson.address1' class="form-control" placeholder="Address" />
<button class="btn btn-default" ng-click="add('people', newPerson)">Add</button>
</div>
<script src="https://code.jquery.com/jquery-2.0.3.min.js" data-require="jquery@*" data-semver="2.0.3"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js" data-require="bootstrap@3.1.1" data-semver="3.1.1"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js" data-require="angular.js@1.2.17" data-semver="1.2.17"></script>
<script src="https://ajax.aspnetcdn.com/ajax/mobileservices/MobileServices.Web-1.1.0.min.js"></script>
<script src="//acdccdn.blob.core.windows.net/cdn/ajax/acdc/0.2/AngularCloudDataConnector.js"></script>
<script src="//acdccdn.blob.core.windows.net/cdn/ajax/acdc/0.2/Providers/azureDataService.js"></script>
<script>
var app = angular.module('demoApp', ['DataModule', 'AzureDataModule', 'ui.bootstrap']);
app.controller('demoController', ['$scope', 'dataService', 'azureDataService',
function($scope, dataService, azureDataService)
{
//function to add a new data entry
$scope.add = function (tableName, entity)
{
dataService.add(tableName, entity, function ()
{
//updates the data after you add data
$scope.sync();
}
, function ()
{
console.log('Problem Adding the Data.')
})
};
//function to sync the data
$scope.sync = function ()
{
dataService.getEntries(function (results)
{
for (var result in results)
{
$scope.$apply($scope[result] = results[result]);
}
});
}
//function to intialize the connection
$scope.initialize = function()
{
azureDataService.addSource('https://angularpeoplev2.azure-mobile.net/', 'DDJpBYxoQEUznagCnyYNRYfkDxpYyz90', ['people']);
dataService.addSource(azureDataService);
dataService.connect(function(results)
{
//sync after the initial response
for (var result in results)
{
$scope.$apply($scope[result] = results[result]);
}
});
}
$scope.initialize();
}
]);
</script>
</body>
</html>