-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathindex.html
119 lines (94 loc) · 5.03 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
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
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Angular Input Stars</title>
<link rel="stylesheet" type="text/css" href="bower_components/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="angular-input-stars.css">
<style>
body, html {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
body {
color: #333;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
display: flex;
align-items: center;
justify-content: center;
}
.container {
min-width: 600px;
text-align: center;
}
i {
transition: color 0.5s;
font-size: 20px !important
}
</style>
</head>
<body >
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div class="container" ng-app="app" ng-controller="AppCtrl as App">
<code>allow-half: true</code> <input-stars ng-model="prop1" on-star-click="App.clickHandler(prop1)" max="5" allow-half ></input-stars> <strong>value: {{prop1}}</strong>
<br>
<code>allow-half: true</code> <input-stars ng-model="prop2" on-star-click="App.clickHandler(prop2)" max="5" allow-half ></input-stars> <strong>value: {{prop2}}</strong>
<br>
<code>allow-half: true</code> <input-stars ng-model="App.prop3" on-star-click="App.clickHandler(App.prop3)" max="5" allow-half ></input-stars> <strong>value: {{App.prop3}}</strong>
<br>
<code>allow-half: false</code> <input-stars ng-model="App.prop4" on-star-click="App.clickHandler(App.prop4)" max="5" ></input-stars> <strong>value: {{App.prop4}}</strong>
<br>
<code>allow-half: false</code> <input-stars ng-model="App.prop5" on-star-click="App.clickHandler(App.prop5)" max="5" ></input-stars> <strong>value: {{App.prop5}}</strong>
<h3>Readonly - not allowing half</h3>
<div ng-init="enableReadonly = true">
<em>
<input type="checkbox" ng-model="enableReadonly" > Toggle readonly
</em>
<pre>{{ enableReadonly }}</pre>
</div>
<code>allow-half: false</code> <input-stars
ng-model="prop1"
max="5"
ng-attr-readonly="{{ enableReadonly || false }}"
ng-attr-icon-empty="{{ enableReadonly ? 'fa-twitter' : 'fa-circle-o' }}"
ng-attr-icon-full="{{ enableReadonly ? 'fa-cog' : 'fa-twitter' }}"
></input-stars> value: {{prop1}}
<br>
<code>allow-half: false</code> <input-stars ng-model="prop2" max="5" ng-attr-readonly="{{ enableReadonly || false }}"></input-stars> value: {{prop2}}
<br>
<code>allow-half: false</code> <input-stars ng-model="App.prop3" max="5" ng-attr-readonly="{{ enableReadonly || false }}"></input-stars> value: {{App.prop3}}
<br>
<code>allow-half: false</code> <input-stars ng-model="App.prop4" max="5" ng-attr-readonly="{{ enableReadonly || false }}"></input-stars> value: {{App.prop4}}
<br>
<code>allow-half: false</code> <input-stars ng-model="App.prop5" max="5" ng-attr-readonly="{{ enableReadonly || false }}"></input-stars> value: {{App.prop5}}
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
<script type="text/javascript" src="angular-input-stars.js"></script>
<script type="text/javascript">
if (window.angular === undefined)
alert('Maybe you should run bower install first :]');
angular.module('app', ['angular-input-stars']);
angular.module('app').controller('AppCtrl', AppCtrl);
AppCtrl.$inject = ['$scope'];
function AppCtrl ($scope) {
var vm = this;
vm.clickHandler= function (prop) {
console.log(prop);
};
$scope.prop1 = 1;
$scope.prop2 = 2;
vm.prop3 = 3;
vm.prop4 = 4;
vm.prop5 = 5;
}
</script>
</body>
</html>