I am using a JavaScript library called "Treant.js" to dynamically generate a tree structure.
Because the DOM elements responsible for the tree structure are dynamically generated as SVG by the Treant.js library, I do not have direct access to those elements at all.
Here is what the HTML looks like
<div class="node nodeBranches>
<p class="node-name>TEXT</p>
</div>
This block of codes gets added to the tree DOM whenever a new data is added via form.
Here is the code that I came up with in order to add "ng-class" directive to the div whose class is node.
var target = angular.element(".nodeBranches");
for (var i = 0; i < target.length; i++) {
target.eq(i).attr("ng-class", "changeClass()");
}
Looking at the developer's tool in chrome, I see that the custom attribute "ng-class" is added to each div.node, but the functionality is not there.
The same thing happens for "ng-click" attribute as well. I can see the custom directive in the code, but it does not work.
How can I make this work using AngularJS?
$compile(target)