TomNeyland / angular-dc

AngularJS directives for dc.js
http://tomneyland.github.io/angular-dc/
MIT License
112 stars 58 forks source link

Timing issue with mean.js stack #47

Closed scfox closed 9 years ago

scfox commented 9 years ago

Anyone got this to work with the mean.js stack? My code works fine standalone, but when I try to put it into mean.js stack I get this error:

Error: osverDim is undefined at Error (native) at http://localhost:3000/lib/angular-dc/dist/angular-dc.js:143:61 at Function.map (http://localhost:3000/lib/angular-dc/dist/lodash.js:3509:27) at lodash.ctor.(anonymous function) as map at Object. (http://localhost:3000/lib/angular-dc/dist/angular-dc.js:137:28) at Scope.$get.Scope.$digest (http://localhost:3000/lib/angular/angular.js:12642:40) at Scope.$get.Scope.$apply (http://localhost:3000/lib/angular/angular.js:12915:24) at http://localhost:3000/lib/angular/angular.js:14426:36 at completeOutstandingRequest (http://localhost:3000/lib/angular/angular.js:4411:10) at http://localhost:3000/lib/angular/angular.js:4725:7

It looks to be a chart.render() call is executing before the data is set on the scope for it to use. What's really strange is it is loading the data remotely, and I can verify that it is not until the data returns that the error is thrown. So it must be some sort of race condition where it is trying to render at the same time the data is being processed to put on the scope.

Any suggestions?

scfox commented 9 years ago

Never fully figured out why wouldn't work, but worked around by refactoring data load to a higher level.