Usman
Usman

Reputation: 61

How can I remove HTML tag from JSON

I have JSON file like

[{"description":"<p> example...</p> </br> <p>paragraph... </p> <div id="test" class="test2" style="left: -10000px; top: 10px; position:absolute;"> <p>paragraph... </p> "}]

So how can I remove the HTML tage such as <p> </p> </br> to display in ionic-framework

Upvotes: 3

Views: 3959

Answers (1)

ngLover
ngLover

Reputation: 4578

If you can't use an HTML parser oriented solution to filter out the tags, here's a simple regex for it.

var noHTML =  OriginalString.replace(/(<([^>]+)>)/ig,"");

Here is the working plunker

Upvotes: 1

Related Questions