-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.html
47 lines (45 loc) · 1.51 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
<html ng-app="app">
<head>
<meta charset="utf-8">
<title>Parking Location</title>
<link rel="stylesheet" type="text/css" href="default.css">
</head>
<body>
<h1>Parking Location</h1>
<div ng-controller="controller">
<p>Enter your car's license plate number:</p>
<input ng-model="num">
<button ng-click="search(num)">Search</button>
<br>
<p ng-bind="message"></p>
<p ng-bind="timestamp"></p>
<p ng-bind="confidence"></p>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
<!-- <script src="angular.min.js"></script> -->
<script>
var appModule = angular.module("app", []);
appModule.controller("controller", ['$scope', '$http', '$location', function($scope, $http, $location) {
var someText = {};
$scope.search = function(num) {
console.log(num);
$http.get($location.absUrl() + 'search?num=' + num).
success(function(record) {
console.log(record);
var message = 'Your car is not found';
var confidence;
var timestamp;
if (record.confidence != 0) {
message = 'Your car is on the ' + record.site_id + ',';
timestamp = 'parked at ' + new Date(Number(record.timestamp)).toTimeString() +'.';
confidence = 'Confidence: ' + record.confidence + '%';
};
$scope.message = message;
$scope.confidence = confidence;
$scope.timestamp = timestamp;
});
};
}]);
</script>
</div>
</body>
</html>