ng-show未评估$ scope.foo.name!==' root'在控制器中动态添加html
var button = d3.select("#someId")
.append("button")
.attr("class", "button")
.attr("ng-show","$scope.foo.name !== 'root'")
.html('{{$scope.foo.name}}').on("click", function(){
up($scope.foo);;
}) .call(function () {
//$compile(this[0][0].parentElement)($scope);
$compile(angular.element(this[0][0].parentElement))($scope);
});
答案 0 :(得分:1)
您无需在模板中使用$scope
:
.attr("ng-show","foo.name !== 'root'")
.html('{{foo.name}}')