我正在使用mean.io starter项目,我正在尝试使用zingchart来显示图表。
当我检查我的代码时,我看到一个看起来像这样的zingchart未定义的错误。Zingchart没有定义错误
我是新来使用mean.io.
我还要提到的是,这是发生在一个新的包,我创建一个名为“仪表板”
这里是我的控制器(dashboard.js):
(function() {
'use strict';
/* jshint -W098 */
angular
.module('mean.dashboard', ['zingchart-angularjs'])
.controller('DashboardController', function($scope) {
$scope.myJson = {
type : 'line',
series : [
{ values : [54,23,34,23,43] },
{ values : [10,15,16,20,40] }
]
};
});
})();
我的HTML文件(index.html的):
<html ng-app="mean.dashboard" ng-init="checkCircle()">
<script type="text/javascript" src="angular.min.js"></script>
<script type="text/javascript" src="zingchart.min.js"></script>
<script type="text/javascript" src="zingchart-angularjs.js"></script>
<script src="dashboard.js"></script>
<body ng-controller="DashboardController" ng-cloak layout="column">
<!-- graph here -->
<h1>Graph Test</h1>
<div ng-controller="DashboardController">
<div zingchart id="myChart" zc-json="myJson" zc-height=500 zc-width=600></div>
</div>
</div>
</div>
</body>
</html>
我app.js文件:
'use strict';
/*
* Defining the Package
*/
var Module = require('meanio').Module;
var Dashboard = new Module('dashboard', ['zingchart-angularjs']);
/*
* All MEAN packages require registration
* Dependency injection is used to define required modules
*/
Dashboard.register(function(app, auth, database, circles) {
//We enable routing. By default the Package Object is passed to the routes
Dashboard.routes(app, auth, database, circles);
//We are adding a link to the main menu for all authenticated users
Dashboard.menus.add({
title: 'dashboard',
link: 'dashboard',
roles: ['authenticated'],
menu: 'main'
});
Dashboard.angularDependencies(['zingchart-angularjs']);
return Dashboard;
});
? – Sajeetharan
你是在谈论项目根app.js? – Harry
无论你上面张贴 – Sajeetharan