-
Notifications
You must be signed in to change notification settings - Fork 0
/
products.html
120 lines (105 loc) · 2.88 KB
/
products.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- Angular -->
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"></script>
<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style media="screen">
h4 {
text-align: center;
}
.img-responsive {
margin: 0 auto;
}
</style>
</head>
<body ng-app="myApp">
<div class="container" ng-controller="productController" border="1">
<div class="col-md-12">
<input class="form-control" type="text" ng-model="searchProduct" placeholder="Søg en madvare">
<div class="row">
<div class="col-md-3 col-sm-4 col-xs-6 btn btn-default" ng-repeat="product in products | filter:searchProduct | orderBy:'name'">
<img class="img-responsive" ng-src="{{ product.img }}">
<h4>{{ product.name | uppercase }}</h4>
</div>
</div>
</div>
<!--
<div class="col-md-4">
<h4>Hvor langt vil du køre?</h4>
<img class="img-responsive" src="img/slider.png"/>
</div>
-->
</div>
<script>
var app = angular.module('myApp', []);
app.controller('productController', function($scope) {
$scope.selectedProducts = [];
$scope.products = [{
"name": "Kartofler",
"img": "img/potato.png"
}, {
"name": "Agurker",
"img": "img/cucumber.png"
}, {
"name": "Æg",
"img": "img/egg.png"
}, {
"name": "Tomater",
"img": "img/tomato.png"
}, {
"name": "Apple",
"img": "img/apple.png"
}, {
"name": "Broccoli",
"img": "img/broccoli.jpeg"
}, {
"name": "Løg",
"img": "img/onion.png"
}, {
"name": "Kylling",
"img": "img/chicken.jpg"
}, {
"name": "Jordbær",
"img": "img/strawberry.png"
}, {
"name": "Gulerod",
"img": "img/carrot.png"
}, {
"name": "Kål",
"img": "img/cabbage.png"
}, {
"name": "Kirsebær",
"img": "img/cherry.ico"
}, {
"name": "Blomkål",
"img": "img/cauliflower.png"
}, {
"name": "Marmelade",
"img": "img/jam.jpeg"
}, {
"name": "Juice",
"img": "img/juice.png"
}, {
"name": "Rødbede",
"img": "img/beetroot.jpeg"
}];
});
//toggle button active
$(document).ready(function(){
$('.btn').click(function(){
if($(this).hasClass('active')){
$(this).removeClass('active')
} else {
$(this).addClass('active')
}
});
});
</script>
</body>
</html>