angular-fullstack - 无法添加模块

时间:2017-09-14 20:34:03

标签: angularjs angular-fullstack

我一直在尝试将角度图表(http://jtblin.github.io/angular-chart.js/)模块添加到我的角度应用中,但我不断收到错误消息:无法找到模块'angular-chart.js'。

这就是我一直在做的事情:

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>

任何提示将不胜感激,谢谢你提前。

1 个答案:

答案 0 :(得分:0)

似乎angular-chart.js不会导出其模块名称&#39; chart.js&#39;。

您必须编写依赖项,例如&#39; chart.js&#39;:

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'])