Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions angular-clndr.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,21 @@
controller = [
"$scope", "$element", "$attrs", "$transclude", function($scope, $element, $attrs, $transclude) {
return $transclude(function(clone, scope) {
var options, render;
var $clndr, options, render;
$element.append(clone);
$scope.$watch('events', function(val) {
return $scope.clndr.setEvents(angular.copy(val || []));
$scope.$watch(function() {
return JSON.stringify($scope.events || {});
}, function(val) {
return $scope.clndr.setEvents(angular.copy($scope.events || []));
});
render = function(data) {
return angular.extend(scope, data);
};
options = angular.extend($scope.options || {}, {
render: render
});
return $scope.clndr = angular.element("<div/>").clndr(options);
$clndr = jQuery("<div/>");
return $scope.clndr = $clndr.clndr(options);
});
}
];
Expand Down
2 changes: 1 addition & 1 deletion angular-clndr.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"url": "http://10kb.mit-license.org"
}
],
"version": "0.3.4",
"main": "./angular-clndr.js",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.5",
Expand Down
11 changes: 7 additions & 4 deletions src/angular-clndr.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ TienClndrDirective = ->
$element.append(clone)

# watch events from tien-clndr-events attribute
$scope.$watch 'events', (val) ->
$scope.clndr.setEvents(angular.copy(val || []))
$scope.$watch () ->
return JSON.stringify($scope.events || {})
, (val) ->
$scope.clndr.setEvents(angular.copy($scope.events || []))

# extend all CLNDR data to scope
render = (data) ->
Expand All @@ -27,8 +29,9 @@ TienClndrDirective = ->
# create options object for optional CLNDR settings
options = angular.extend($scope.options || {}, render: render)

# init CLNDR in virtual DOM-element
$scope.clndr = angular.element("<div/>").clndr(options)
# init CLNDR in virtual DOM-element, and it must use jQuery.
$clndr = jQuery("<div/>");
$scope.clndr = $clndr.clndr(options)
]
return {restrict: 'E', replace: true, transclude: true, scope: scope, controller: controller}

Expand Down