2

<div ng-bind="model">
  <div>inner html</div>
</div>

Does anyone know how to display the inner div? Seems the ng-bind directive will always rewrite div element.

Thanks in advance.

Chen Dachao
  • 1,736
  • 2
  • 21
  • 36

1 Answers1

2

ng-bind will always print what is in the model. You can do the following thing:

<div>
    <div ng-bind="model"></div>
    <div>inner html</div>
</div>

Either you can do something like:

//JS
app.controller("nameController", function($sce) {
   model = $sce.trustAsHtml("<div>inner html</div>");
});

//HTML
<div ng-bind-html="model"></div>
Marlon Barcarol
  • 508
  • 5
  • 12