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