-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathangular-clndr.js
49 lines (43 loc) · 1.21 KB
/
angular-clndr.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*!
* angular-clndr 0.3.0
* 10KB, http://10kb.nl/
* License: MIT
*/
(function() {
var TienClndrDirective, module;
module = angular.module('tien.clndr', []);
TienClndrDirective = function() {
var controller, scope;
scope = {
clndr: '=tienClndrObject',
events: '=tienClndrEvents',
options: '=?tienClndrOptions'
};
controller = [
"$scope", "$element", "$attrs", "$transclude", function($scope, $element, $attrs, $transclude) {
return $transclude(function(clone, scope) {
var options, render;
$element.append(clone);
$scope.$watch('events', function(val) {
return $scope.clndr.setEvents(angular.copy(val || []));
});
render = function(data) {
return angular.extend(scope, data);
};
options = angular.extend($scope.options || {}, {
render: render
});
return $scope.clndr = angular.element("<div/>").clndr(options);
});
}
];
return {
restrict: 'E',
replace: true,
transclude: true,
scope: scope,
controller: controller
};
};
module.directive('tienClndr', TienClndrDirective);
}).call(this);