ng-show 不评估 $scope.foo.name !== 'root' 在 Controller 中动态添加 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);
});
最佳答案
您不需要在模板中使用$scope
:
.attr("ng-show","foo.name !== 'root'")
.html('{{foo.name}}')
关于javascript - ng-show 不评估 $scope.foo.name !== 'root' 在 Controller 中动态添加 html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43334628/