Skip to content
This repository was archived by the owner on Nov 26, 2022. It is now read-only.

Commit 84e8e52

Browse files
committed
watch data and options
1 parent f752b58 commit 84e8e52

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ bower_components/
44
node_modules/
55
!.gitkeep
66
.DS_Store
7+
npm-debug.log

dist/tc-angular-chartjs.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ function TcChartjsFactory() {
119119
};
120120
}
121121

122-
$scope.$watch('data', function ( value ) {
123-
if (value) {
122+
$scope.$watch('[data, options]', function (value) {
123+
if (value && $scope.data) {
124124
if (chartObj && typeof chartObj.destroy === 'function') {
125125
chartObj.destroy();
126126
}
@@ -139,7 +139,6 @@ function TcChartjsFactory() {
139139

140140
if (showLegend) {
141141
$scope.legend = chartObj.generateLegend();
142-
console.log($scope.legend);
143142
}
144143

145144
if (autoLegend) {

dist/tc-angular-chartjs.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tc-angular-chartjs.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ function TcChartjsFactory() {
9797
};
9898
}
9999

100-
$scope.$watch('data', function ( value ) {
101-
if (value) {
100+
$scope.$watch('[data, options]', function (value) {
101+
if (value && $scope.data) {
102102
if (chartObj && typeof chartObj.destroy === 'function') {
103103
chartObj.destroy();
104104
}
@@ -117,7 +117,6 @@ function TcChartjsFactory() {
117117

118118
if (showLegend) {
119119
$scope.legend = chartObj.generateLegend();
120-
console.log($scope.legend);
121120
}
122121

123122
if (autoLegend) {

0 commit comments

Comments
 (0)