It seems you should use element[0] when creating the directive with D3, for example, as shown below:
app.directive('firstTry', function () { function link(scope, element, attrs) { var sampleSVG = d3.select(element[0]) ...
So why is element[0] but not element ? The name element suggests that this is a single object, not an array, but apparently this is not the case. Another question: what else does this element ?
By the way, any official links on this issue would be very helpful.
Many thanks.
Jbt
source share