-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathicheck.directive.js
28 lines (28 loc) · 1.02 KB
/
icheck.directive.js
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
angular.module('santeportalApp')
.directive('iCheck', function($timeout) {
return {
restrict: 'AE',
scope: {
ngModel: '=',
ngChange: '&'
},
template: '<input type="checkbox" />',
link: function(scope, element, attrs, ctrl) {
scope.changeEvent = function() {
scope.$apply(function() {
scope.ngModel = !scope.ngModel;
$timeout(scope.ngChange, 0);
});
};
return $timeout(function() {
return $(element).iCheck({
radioClass: 'iradio_square-green',
checkboxClass: 'icheckbox_square-green',
increaseArea: '20%'
}).on('ifChanged', function(event) {
scope.changeEvent();
});
});
}
};
});