2017-09-14 39 views
0

我一直在試圖添加角度圖(http://jtblin.github.io/angular-chart.js/)模塊到我的角度應用程序,但我不斷收到錯誤消息:找不到模塊'angular-chart.js'。angular-fullstack - 無法添加模塊

這是我一直在做:

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> 

任何提示將不勝感激,先進的謝謝你。

回答

0

似乎angular-chart.js不會導出它的模塊名稱'chart.js'。

你必須寫像 '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'])