Unable to remove html tags from response JSON

Question!

Hi I am new to AngularJS. I am having a problem parsing JSON data to proper format. Actually the JSON response itself returned HTML format data (it contains HTML tags like &lt,;BR,> etc). If I check the response in browser it returns fine, but in device(TAB,MOBILE) the HTML tags are also getting appended. I am using AngularJS to bind the JSON response to DOM. Is there any way to simply ignore HTML tags in JQuery or in AngularJs? At the same time I don't want to remove the HTML tags as they are necessary to define "new line", "space", "table tag" etc.

A sample response I am getting is like:

A heavier weight, stretchy, wrinkle resistant fabric.<BR><BR>Fabric Content:<BR>100% Polyester<BR><BR>Wash Care:<BR> 

If I apply the binding using {{pdp.desc}}, the HTML tags are also getting added. Is there any way to accomplish this?

I have added ng-bind-html-unsafe="pdp.desc", but still "BR" tags r coming.



Answers

Try to use three pairs of brackets {{{pdp.desc}}} In Handlebars it works, possible in your case to.



Use JS HTML parser

var pattern = @"
By : Ali


This video can help you solving your question :)
By: admin