-
Notifications
You must be signed in to change notification settings - Fork 0
/
flickr.html
94 lines (58 loc) · 2.85 KB
/
flickr.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
<html lang="en">
<head>
<link rel="stylesheet" href="css/bootstrap.min.css">
<style>
</style>
</head>
<body ng-app="myApp">
<div class="container-fluid" style="padding:50px">
<p class="text-center">By Mark Thien</p>
<div ng-controller="formController">
<form ng-submit="processForm()">
<!-- NAME -->
<div id="name-group" class="form-group">
<input type="text" name="searchText" class="form-control" placeholder="Search Text Here" ng-model="formData.searchText">
</div>
<!-- SUBMIT BUTTON -->
<button type="submit" class="btn btn-success btn-lg btn-block">
<span class="glyphicon glyphicon-flash"></span> Search
</button>
</form>
<div class="row">
<div ng-repeat="x in photos">
<div class="col-md-6 text-center">
<image ng-src="{{x}}" />
</div>
</div>
</div>
</div>
</div>
<script src="js/jquery-1.12.0.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/angular.min.js"></script>
<script>
var app = angular.module('myApp', []), server = 'http://enormers.com:8009/';
app.controller('formController', function($scope, $http) {
$http.get(server+"get-public-feed").then(function (response) {
$scope.photos = response.data.object;
});
$scope.formData = {};
// process the form
$scope.processForm = function() {
$http({
method : 'POST',
url : server+'search-photo',
data : $.param($scope.formData), // pass in data as strings
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(data) {
if (data.status === 200) {
$scope.photos = data.object;
} else {
alert(data.text);
}
});
};
});
</script>
</body>
</html>