angular-fullstack - unable to add modules

54 views Asked by At

I've been trying to add the angular-chart (http://jtblin.github.io/angular-chart.js/) module to my angular app, but I keep getting the error message: Cannot find module 'angular-chart.js'.

This is what I've been doing:

webpack.make.js

    if(TEST) {
    config.entry = {};
} else {
    config.entry = {
        app: './client/app/app.ts',
        polyfills: './client/polyfills.ts',
        vendor: [
            'angular',
            'angular-animate',
            'angular-aria',
            'angular-cookies',
            'angular-resource',
            'angular-route',
            'angular-sanitize',
            'angular-ui-bootstrap',
            'lodash',
            'angular-chart'
        ]
    };
}

app.ts

import chart from 'angular-chart.js';

angular.module('mmcApp', [ngCookies, ngResource, ngSanitize, ngRoute, 
uiBootstrap, _Auth, account, admin, 'validation.match', navbar, 
footer, main, constants, graphs, about, chart])

_index.html

<head>
  <script src="../node_modules/angular-chart.js/dist/angular-chart.min.js"></script>
</head>

Any tips will be appreciated, thank you in advanced.

1

There are 1 answers

0
scipper On BEST ANSWER

It seems that angular-chart.js does not export its module name 'chart.js'.

You have to write the dependency like 'chart.js':

import 'angular-chart.js';

angular.module('mmcApp', [ngCookies, ngResource, ngSanitize, ngRoute, 
uiBootstrap, _Auth, account, admin, 'validation.match', navbar, 
footer, main, constants, graphs, about, 
'chart.js'])