ng-show 未评估 $scope.foo.name !== 'root' 在控制器中动态添加 html
ng-show not evaluating $scope.foo.name !== 'root' dynamically added html in controller
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);
});
您不需要在模板中使用 $scope
:
.attr("ng-show","foo.name !== 'root'")
.html('{{foo.name}}')
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);
});
您不需要在模板中使用 $scope
:
.attr("ng-show","foo.name !== 'root'")
.html('{{foo.name}}')