0
我已经在D3中使用eval函数动态创建了比例尺,但是当我使用角度为d3时,eval函数无法正常工作,并且通过错误而我称为比例。角与D3 js
TypeError: e.copy is not a function
at SVGGElement.<anonymous> (http://localhost:3000/app/d3.v3.min.js:5:13917)
at http://localhost:3000/app/d3.v3.min.js:3:15103
at Y (http://localhost:3000/app/d3.v3.min.js:1:4505)
at Array.Co.each (http://localhost:3000/app/d3.v3.min.js:3:15078)
at Array.n (http://localhost:3000/app/d3.v3.min.js:5:13838)
at Array.Co.call (http://localhost:3000/app/d3.v3.min.js:3:15178)
at Scope.HistoricalGraph.$scope.draw (http://localhost:3000/app/beanstalk/yhgraph/historicalgraph/historicalgraph.controller.js:418:26)
at fn (eval at <anonymous> `enter code here`(http://localhost:3000/bower_components/angular/angular.js:14432:15), <anonymous>:2:203)
at expensiveCheckFn (http://localhost:3000/bower_components/angular/angular.js:15485:18)
at ngEventDirectives.(anonymous function).compile.element.on.callback (http://localhost:3000/bower_components/angular/angular.js:25018:17)
'eval'是邪恶的尽量避免它。把一些代码放在你的问题 – murli2308
但是如何在角度js中动态地创建变量.. 我的意思是说,假设我有3个通道,如 var channel = [“x”,“y”,“z”]; 所以我想动态声明3个变量并分配一些值。我怎么能 var x =一些价值 var y =一些值 如果我在正常的js中使用eval函数,那么它会很好,但在角度它会给一些错误 – Sujit