I am trying to use d3 in angular using a factory but I keep on getting error
Error: undefined is not a function (evaluating 'd3Service.d3().then')
Obviously I must be doing something wrong, but I just can't spot it and this has last for several days now! Maybe you have a hint ? thanks in advance
d3.js
angular.module('d3', [])
.factory('d3Service', [function(){
return {
d3: function(){
return !function(){ d3 code here }();
}
}
]);
directives.js
angular.module('starter.directives', ['d3'])
.directive('d3circle', ['d3Service', function(d3Service) {
return {
scope: {},
link: function(scope, element, attrs) {
d3Service.d3().then(function(d3){
});
}
}
}
]);