AngularJS ng-hide not working with html binding to a div

375 views Asked by At

I'm trying to render html content from a controller , but the angular directive ng-hide doesn't work , I've tried the following code, does it have a problem with binding as html this way?

      var htmlContent = "<Div class='vzone'  ng-hide='true' id='parent_" +  ViewerZones[CurrentIndex].Id + "'...'></div>";
  
$scope.PageContent = $sce.trustAsHtml(htmlContent);
<div  ng-bind-html="PageContent"></div>

1

There are 1 answers

1
Kalhan.Toress On

try this one,

 var htmlContent = "<Div class='vzone'  ng-.....

$scope.PageContent = $sce.trustAsHtml($compile(htmlContent));

don't forget to add $compile dependency in your controller.

$compile service will bind your dynamic directives with the controller