javascript – 为什么我不能渲染这个angularJS代码?
作者:互联网
此代码使用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中渲染它时,我只得到一个空白页面,并出现以下错误:
Uncaught Error: [$injector:modulerr] 07001$injector/modulerr?p0=myApp&p1=Error%3A%…gleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.14%2Fangular.min.js%3A17%3A381)
我找了类似的错误,但他们的解决方案似乎没有解决我的问题.
解决方法:
关闭脚本标签!
<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>
结果
标签:zingchart,javascript,angularjs 来源: https://codeday.me/bug/20190829/1760779.html