diff --git a/addon/components/ember-chart.js b/addon/components/ember-chart.js index 42de058..a7f630b 100644 --- a/addon/components/ember-chart.js +++ b/addon/components/ember-chart.js @@ -297,13 +297,16 @@ export default Component.extend({ // destroy the chartjs object class this.get('chart').destroy(); - // remove the observers - this.addObserver('data', this, this.updateChart); - this.addObserver('data.[]', this, this.updateChart); - this.removeObserver('model', this, this.updateChart); - this.removeObserver('model.[]', this, this.updateChart); - this.removeObserver('_page', this, this.updateChart); - this.removeObserver('colors.[]', this, this.updateChart); + // remove the observers + if (this.get('isModel')) { + this.removeObserver('model', this, this.updateChart); + this.removeObserver('model.[]', this, this.updateChart); + this.removeObserver('_page', this, this.updateChart); + this.removeObserver('colors.[]', this, this.updateChart); + } else { + this.removeObserver('data', this, this.updateChart); + this.removeObserver('data.[]', this, this.updateChart); + } this.removeObserver('options', this, this.redrawChart); this.removeObserver('type', this, this.redrawChart); },