"Like / Dislike count with angular js"
Bootstrap 3.0.0 Snippet by vicky04666

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
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<body ng-app="myModule">
<div class="col-md-10 col-md-offset-1 col-xs-12 col-sm-12" ng-controller="myController">
<div class="col-md-12 col-xs-12">
<div class="col-md-3 div1 col-xs-3 ">
<p>Language</p>
</div>
<div class="col-md-3 div2 col-xs-3">
<p>Likes</p>
</div>
<div class="col-md-3 div3 col-xs-3 dislike">
<p>Dislikes</p>
</div>
<div class="col-md-3 div4 col-xs-3">
<p>Likes/Dislikes</p>
</div>
</div>
<div class="col-md-12 col-xs-12 text-center " ng-repeat="technology in technologies ">
<div class="col-md-3 div_sub col-xs-3">
<h6>{{ technology.name }}</h6>
</div>
<div class="col-md-3 div_sub col-xs-3">
<h6><span>{{ technology.likes }}</span> Likes</h6>
</div>
<div class="col-md-3 div_sub col-xs-3 dislike">
<h6><span>{{technology.dislikes}}</span> Dislikes</h6>
</div>
<div class="col-md-3 div_sub col-xs-3 ">
<button type="button" class="btn btn-success" ng-click="incrementLikes(technology)"><span class="glyphicon glyphicon-thumbs-up"></span> Likes</button>
<button type="button" class="btn btn-danger" ng-click="incrementDislikes(technology)"> <span class="glyphicon glyphicon-thumbs-up"></span>Dislikes</button>
</div>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
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
body {
font-size: 20px;
}
*,
p {
margin: 0px;
padding: 0px;
}
p {
line-height: 3.5em;
text-align: center;
font-size: 1em;
}
h6 {
line-height: 35px;
font-size: 18px;
}
h6 span {
color: green;
font-weight: bold;
}
.btn {
margin: 10px 5px 11px 0px;
}
.dislike h6 {
line-height: 35px;
font-size: 18px;
}
.dislike h6 span {
color: red;
font-weight: bold;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: