"Problem description"
One of the great strengths of angular JS is his data bidirectional binding function----->ng-bind and the Ng-model for the form
But in our project we will encounter this situation, the data returned in the background with a variety of HTML tags
The browser does not parse these HTML tags when angularjs output html
We use instructions such as ng-bind-html to bind, the browser is displayed in the HTML code
"Solution---$sce"
By using $ sce.trustashtml (). This method converts the value to be accepted by the privilege and is safe to use "ng-bind-html"
We can also use this as a filter that can be called at any time on the template.
Filter Code:
App.filter (' to_trusted ', [' $sce ', function ($SCE) {return function (text) { return $sce. trustashtml (text); };}]);
HTML code:
<ng-bind-html= "currentwork.description | to_trusted"></p >
"AngularJs"---$sce output html