Skip to content

Instantly share code, notes, and snippets.

@mgonto
Created May 19, 2013 02:01
Show Gist options
  • Save mgonto/5606372 to your computer and use it in GitHub Desktop.
Save mgonto/5606372 to your computer and use it in GitHub Desktop.
directive proposed
module.directive('pie', function () {
return {
replace: true,
restrict: 'EA',
scope: {type: '@', data:'='},
templateUrl: "/js/test/angular/partials/pie.html",
controller: ['$scope', '$routeParams', '$element', '$filter', function($scope, $routeParams, $element, $filter) {
$scope.$watch('data', function() {
if (_.isUndefined($scope.data) || _.isNull($scope.data) || $filter('isZeroData')($scope.data)) {
$element.hide();
} else {
$element.show();
$element.plot($scope.data);
}
});
}]
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment