0

Based off of : Dynamically add directive in AngularJS

I am trying to add a directive after to an element after the element's creation and page load.

$(nRow) refers to a element. Currently with the following code nothing happens the elements doesn't get the attributes. If I remove the replaceWith I get the element with the attributes but the directive isn't applied.

 var row = angular.element($(nRow)).clone();
    row.attr("tooltips", "");
    row.attr("tooltip-template", "tooltip");
    row.attr("tooltip-smart", "true");
    row.attr("tooltip-speed", "slow");
    row.attr("tooltip-size", "large");
    row = $compile(row)($scope);
    $(nRow).replaceWith(row);
    $scope.$apply();
Community
  • 1
  • 1
Ya Wang
  • 1,758
  • 1
  • 19
  • 41

1 Answers1

0

$(nRow) was not referencing the right object.

Ya Wang
  • 1,758
  • 1
  • 19
  • 41