ng-show没有评估$ scope.foo.name!==' root'在控制器中动态添加html

时间:2017-04-10 23:55:53

标签: javascript angularjs ng-show

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);

            });

1 个答案:

答案 0 :(得分:1)

您无需在模板中使用$scope

.attr("ng-show","foo.name !== 'root'")
.html('{{foo.name}}')