0

I am trying to bind html to my div element, but dont really know how to do it. I am not great with angularjs, but should ng-bind-html do the trick?

This is how I tried to do it,

<div ng-bind-html="{{tile.Info.Title}}"></div>
<div ng-bind-html="{{tile.Info.Content}}"></div>

In angular 2 its just [innerHTML], cant get it to work here, any suggestion?

Nemanja Grabovac
  • 858
  • 2
  • 15
  • 30

2 Answers2

2

You can get an example here.

<div ng-controller="ExampleController">
 <p ng-bind-html="myHTML"></p>
</div>
Quan VO
  • 1,258
  • 11
  • 19
1

As also suggested in comments by @Aleksey when you are using ng- there is no need to use curly brackets {}. So your code should be like:

<div ng-bind-html="tile.Info.Title"></div>
<div ng-bind-html="tile.Info.Content"></div>
a1626
  • 2,953
  • 1
  • 19
  • 34
Kannan Thangadurai
  • 1,117
  • 2
  • 17
  • 36