2016-07-08 30 views
0

Dynamically add directive in AngularJSAngularjs - 屬性後刷新TR要新增關閉的指令

我想元素的創作和頁面加載後後添加一個指令的元素。

$(nRow)是指元素。目前使用下面的代碼沒有任何反應,元素沒有得到屬性。如果我刪除replaceWith我得到的屬性的元素,但指令不適用。

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(); 
+0

你可以請添加一些更多的代碼或plunker? – varit05

回答

0

$(nRow)沒有引用正確的對象。