Skip to content

Commit

Permalink
fix: allow setting an empty events array
Browse files Browse the repository at this point in the history
Fixes #12
  • Loading branch information
rolandboon committed Jun 23, 2015
1 parent db1beaf commit 99d1f53
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions angular-clndr.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
var options, render;
$element.append(clone);
$scope.$watch('events', function(val) {
if (val != null ? val.length : void 0) {
return $scope.clndr.setEvents(angular.copy(val));
}
return $scope.clndr.setEvents(angular.copy(val || []));
});
render = function(data) {
return angular.extend(scope, data);
Expand Down
2 changes: 1 addition & 1 deletion angular-clndr.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
* 10KB, http://10kb.nl/
* License: MIT
*/
(function(){var a,b;b=angular.module("tien.clndr",[]),a=function(){var a,b;return b={clndr:"=tienClndrObject",events:"=tienClndrEvents",options:"=?tienClndrOptions"},a=["$scope","$element","$attrs","$transclude",function(a,b,c,d){return d(function(c,d){var e,f;return b.append(c),a.$watch("events",function(b){return(null!=b?b.length:void 0)?a.clndr.setEvents(angular.copy(b)):void 0}),f=function(a){return angular.extend(d,a)},e=angular.extend(a.options||{},{render:f}),a.clndr=angular.element("<div/>").clndr(e)})}],{restrict:"E",replace:!0,transclude:!0,scope:b,controller:a}},b.directive("tienClndr",a)}).call(this);
(function(){var a,b;b=angular.module("tien.clndr",[]),a=function(){var a,b;return b={clndr:"=tienClndrObject",events:"=tienClndrEvents",options:"=?tienClndrOptions"},a=["$scope","$element","$attrs","$transclude",function(a,b,c,d){return d(function(c,d){var e,f;return b.append(c),a.$watch("events",function(b){return a.clndr.setEvents(angular.copy(b||[]))}),f=function(a){return angular.extend(d,a)},e=angular.extend(a.options||{},{render:f}),a.clndr=angular.element("<div/>").clndr(e)})}],{restrict:"E",replace:!0,transclude:!0,scope:b,controller:a}},b.directive("tienClndr",a)}).call(this);
2 changes: 1 addition & 1 deletion src/angular-clndr.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ TienClndrDirective = ->

# watch events from tien-clndr-events attribute
$scope.$watch 'events', (val) ->
$scope.clndr.setEvents(angular.copy(val)) if val?.length
$scope.clndr.setEvents(angular.copy(val || []))

# extend all CLNDR data to scope
render = (data) ->
Expand Down

0 comments on commit 99d1f53

Please sign in to comment.