3

此代码取自以下使用 ZingChart 的教程。 http://www.zingchart.com/blog/2015/03/05/zingchart-angularjs/

我的代码如下所示:

//my-zingchart.html
<html ng-app="myApp">
<head>
   <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js">
   <script src="http://cdn.zingchart.com/zingchart.min.js">
   <script src="node_modules/zingchart-angularjs/src/zingchart-angularjs.js">
   <script>
       var app = angular.module('myApp',['zingchart-angularjs']);

        app.controller('MainController', function($scope){
        $scope.myData = [1,4,5,5,10];
});
   </script>
</head>
<body>
 <div ng-controller="MainController">
<zingchart id="chart-1" zc-values="myData"></zingchart>
</div>
 </body>
</html>

当我尝试在 chrome 中渲染它时,我只得到一个空白页,并且出现以下错误:

未捕获的错误:[$injector : modulerr] http://errors.angularjs.org/1.3.14/$injector/modulerr?p0=myApp&p1=Error%3A%…gleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.14 %2Fangular.min.js%3A17%3A381)

我一直在寻找类似的错误,但他们的解决方案似乎无法解决我的问题。

4

1 回答 1

5

关闭您的脚本标签!

<html ng-app="myApp">
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
    <script src="http://cdn.zingchart.com/zingchart.min.js"></script>
    <script src="node_modules/zingchart-angularjs/src/zingchart-angularjs.js"></script>
    <script>
        var app = angular.module('myApp', ['zingchart-angularjs']);

        app.controller('MainController', function ($scope) {
            $scope.myData = [1, 4, 5, 5, 10];
        });
    </script>
</head>
<body>
    <div ng-controller="MainController">
        <zingchart id="chart-1" zc-values="myData"></zingchart>
    </div>
</body>
</html>

结果

工作中

于 2016-01-17T20:28:11.023 回答