dimanche 13 janvier 2019

Ember.Computed is not a function

I'm trying to setup simple application with Ember using ember-chart: https://www.npmjs.com/package/ember-cli-chart

I have my charts.hbs file:

<div class="container-fluid">
    <div class="row">
        <div class="col-md-12">
        
            <div class="chart-container">
                
            </div>
        
        </div>
    </div>
</div>

and my charts.js controller with sample from documentation of Chart.js:

import Controller from '@ember/controller';
import Ember from "ember";

export default Controller.extend({
    CHARTTYPE: 'bar',
    CHARTDATA: Ember.Computed('', function () {
        return {
            labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
            datasets: [{
                label: '# of Votes',
                data: [12, 19, 3, 5, 2, 3],
                backgroundColor: [
                    'rgba(255, 99, 132, 0.2)',
                    'rgba(54, 162, 235, 0.2)',
                    'rgba(255, 206, 86, 0.2)',
                    'rgba(75, 192, 192, 0.2)',
                    'rgba(153, 102, 255, 0.2)',
                    'rgba(255, 159, 64, 0.2)'
                ],
                borderColor: [
                    'rgba(255,99,132,1)',
                    'rgba(54, 162, 235, 1)',
                    'rgba(255, 206, 86, 1)',
                    'rgba(75, 192, 192, 1)',
                    'rgba(153, 102, 255, 1)',
                    'rgba(255, 159, 64, 1)'
                ],
                borderWidth: 1
            }]
        }
    }),
    CHARTOPTIONS: Ember.Computed('', function () {
        return {
            scales: {
                yAxes: [{
                    ticks: {
                        beginAtZero:true
                    }
                }]
            }
        }
    }),
    CHARTWIDTH: 500,
    CHARTHEIGHT: 500,
});

In index.js route i have redirection to charts route:

beforeModel() {
    this.replaceWith('charts');
}

When I am trying to open my localhost:4200 after ember s it gives me an error in console:

router.js:927 Error while processing route: index Ember.Computed is not a function TypeError: Ember.Computed is not a function

I tried to search for an answer but nothing seems to work.




Aucun commentaire:

Enregistrer un commentaire