I have the following Angular directive:
var OrgChartDirective = function() {
return {
restrict: 'AE',
scope: {
source : '=',
container : '=',
stack : '=',
depth : '=',
interactive: '=',
showLevels : '=',
clicked : '=' // We use '=' here rather than '&' for this callback function
},
link: function(scope, element, attrs) {
var target = $(element);
var source = $('#' + scope.source);
var options = {
container : target,
nodeClicked: scope.clicked,
stack : scope.stack,
depth : scope.depth,
interactive: scope.interactive,
showLevels : scope.showLevels
};
console.log("Drawing org chart at " + scope.source + " on " + target);
console.log(scope);
source.orgChart(options);
}
}
};
I add it to the page like:
<org-chart source='list-for-wf'/> or <div org-chart source='list-for-wf'> </div>
Problem is, in my console, I see:
Drawing org chart at 0 on [object Object]
Why is the source returning 0, this is like jquery when you try to access an invalid element. Even if I log the source as the first line of the link function it is 0
Why is that? I have tried data-source="..." and all kinds of stuff. Any ideas?
source: '='tosource: '@'