未捕获的ReferenceError:未定义类

时间:2014-12-18 11:00:05

标签: javascript angularjs html5 class

我正在关注此示例Create bar chart,但出现错误Uncaught ReferenceError: Class is not defined

我已经包含了prototype.js的库

 <script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.2.0/prototype.js"></script>

这是代码,

HTML

<div id="d3area" angulard3-ear-chart datajson="'sample.json'" xaxis-name = "" xaxis-pos= "" yaxis-name="'Price/($)'" yaxis-pos="12" d3-format="'%d-%b%y'"

指令,

App.Js

var BarGraph = Class.create({
initialize: function(datajson,xaxisName,xaxisPos,yaxisName,yaxisPos,d3Format) {
this.datajson = datajson;
this.xaxisName = xaxisName;
this.xaxisPos = xaxisPos;
this.yaxisName = yaxisName;
this.yaxisPos = yaxisPos;
this.d3Format = d3Format;
},
workOnElement: function(element) {

},

1 个答案:

答案 0 :(得分:1)

正如我在评论中已经提到的,你应该等到加载所有东西(包括Prototype.js)。这可以按照here所述完成。基本上将代码的执行与onload事件联系起来。