In the front-end and back-end pull, a large part of it is due to data problems. You will encounter such a problem when using angular. The data returned in the background is not the pure string you want, but with html tags and attributes. After we output it, content with tags appears on the page, which is very inelegant. Then looking for background changes will cause a war of discussion and raising, and people may not have time to pay attention to you. In this case, we have to do it ourselves and have enough food and clothing.
Usually there is such a method for angular binding data, {{}} or ng-bind = ". If the data is data with html tags at this time, then the data with tags will be output as data with tags, which is not friendly.
How to change it?
Method 1
To output content without html, two steps are required
1 Use the $(); method to convert the data into unwrapTrustedValue data.
$ = $("<h3>html code</h3>");
2 ng-bind-html output
<div ng-bind-html='aaa'></div>
Method 2 filter filter
Based on the $() method, a filter is constructed to filter.
('app',[]).filter("showAsHtml",function($sce){ return funciton(input){ retrun $(input); } });
When using it, just add a filter after the data
<div ng-bind-html='bbb|showAsHtml'></div>
When using $(), when displaying, the form of ng-bind-htm=' must be used, and cannot use {{}}
The above example of angular outputting html code as content is all the content I share with you. I hope you can give you a reference and I hope you support me more.