1

I need this :

<div><div> May I help you </div></div>

The inner div part should be coming from angular controller :

<div> May I help you </div>

So my html will change to this :

<div>{{AskHelpText}}</div>

AskHelpText is coming from XYZController - AngularController

Currently its rendering like this :

<div>"<div> May I help you </div>"</div>
NayeemKhan
  • 1,210
  • 7
  • 19
  • 38

2 Answers2

3

Try ng-bind-html directive

<div ng-bind-html="AskHelpText"></div>

read more here

Don't forget to use angular sanitize on your app module.

Saqueib
  • 3,484
  • 3
  • 33
  • 56
1

You can provide attribute ng-bind-html to the outer div and use $sce.trustAsHtml() in your controller.

You can try something like this:

HTML

<div ng-bind-html="someName"></div>

Controller

$scope.someName=$sce.trustAsHtml(htmlVariableName);

Pramod Karandikar
  • 5,289
  • 7
  • 43
  • 68