【发布时间】:2017-06-17 19:44:59
【问题描述】:
我正在使用 mean.io 入门项目,我正在尝试使用 zingchart 显示图表。
当我检查我的代码时,我看到一个 zingchart not defined 错误,看起来像这样。
我是使用 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;
});
【问题讨论】:
-
你没有使用 app.js 吗?
-
你说的是项目根app.js吗?
-
您在上面发布的任何内容
-
我相信我正在使用它
标签: javascript angularjs mean.io zingchart