Search code examples
angularjszingchart

"zingchart-angularjs is not available"


I'm new to angular and web applications in general and I'm having a hard time trying to using zingchart.

What I'd like to do is create charts on an angular application through zingchart, but I'm getting this error on the browser console when I try to run my application.

I'm sure I've correctly added the 'zingchart-angularjs' dependency in my controller, but I'm not that sure about declaring the zingchart libraries inside my hmtl. I have a few questions, please:

1) I downloaded zingchart, but couldn't find the zingchart.min.js file after the download. How important is it to make the whole thing work? How to download it?

2) I work on eclipse. Should I install zingchart on eclipse as a plugin? If so, can someone help? So far I simply moved the zingchart-angularjs.js file to my project folder and declared its path on my html within the script tags. Will it work on eclipse?

3) How should I exactly declare the zingchart libs inside the html? I mean, should I inform the FULL path for the zingchart-angularjs.js file, like "script type="text/javascript" src="C:/kdi/workspace/cnt-ui-web/src/main/webapp/app/spas/cnt/partials/zingchart.min.js" /script or declaring the relative path is enough? If the latter, how should that be?

Thanks.


Solution

  • Question 1) -> Yes you need to add zingchart.min.js or zingchart.js in your html. You can include the cdn for zingchart.min.js (zingchart cdn version) in html as,

     http://cdn.zingchart.com/zingchart.min.js
    

    Question 2) -> No you need not install zingchart as a plugin. You just need to include the js files(libraries) in your project.

    Question 3) -> No need to provide the full path. Relative path to your html file will do. See relative path vs absolute path

    The sequence of .js files should be,

    <script type="text/javascript" src="angular.min.js"></script>
    <script type="text/javascript" src="http://cdn.zingchart.com/zingchart.min.js"></script>
    <script type="text/javascript" src="zingchart-angularjs.js"></script>
    

    Take care of the paths in src attribute, that's the path of file.