Ionic + Angular Charts:Uncaught Error:需要包含Chart.js库 [英] Ionic + Angular Charts: Uncaught Error: Chart.js library needs to included

查看:155
本文介绍了Ionic + Angular Charts:Uncaught Error:需要包含Chart.js库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将图表包含到我的Ionic应用程序中,但是我收到错误。
我已将angular.js文件夹和chart.js文件夹下载到我的lib文件夹中,并将以下行添加到index.html:

I am trying to include charts into my Ionic application, but I get error. I have download the angular.js folder and chart.js folder into my lib folder and added the following lines to index.html:

<script src="lib/angular-chart.js/dist/angular-chart.js"></script>
<script src="lib/chart.js/dist/Chart.js"></script>
<script src="lib/angular-chart.js/dist/angular-chart.min.js"></script>
<script src="lib/chart.js/dist/Chart.min.js"></script>

我还将chart.js添加到我的模块中:angular.module('myApp',['ionic ','chart.js'])但我仍然得到错误:未捕获错误:Chart.js库需要包括

I also added chart.js to my module: angular.module('myApp', ['ionic', 'chart.js']) but I still get the error: Uncaught Error: Chart.js library needs to included

我做错了什么,我怎么能在我的应用程序中使用chart.js?

What am I doing wrong, how can I use chart.js in my app?

推荐答案

修正是放在angular-chart.js之前,正如Jossef Harush在我的帖子中暗示的那样。
导入min和普通js文件

The fix was to put before angular-chart.js as Jossef Harush implied as a comment in my post. Also it is redundant to import both "min" and normal js files

这篇关于Ionic + Angular Charts:Uncaught Error:需要包含Chart.js库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆