I'm building a new project in angularJS. Backend is PHP with MySQL. PHP API returns data to angular which I need to show in front view.
But HTML tags are not getting decoded in my website. Thay are shown as such. When I try the same in phpfiddle.org, it works.
User submits data through a wysiwyg editor and it is saved in database table something like this:
<p>dfgdfgdfgfd</p><p><br/></p><p>dg</p><p>d</p><p>g</p><p><span class="rangySelectionBoundary" id="selectionBoundary_1472644203224_7186990890070339">&#65279;</span>df<span class="rangySelectionBoundary" id="selectionBoundary_1472644203224_09491296280590866">&#65279;</span></p><p><span class="rangySelectionBoundary" id="selectionBoundary_1472644197601_045958185758413816">&#65279;</span>g<span class="rangySelectionBoundary" id="selectionBoundary_1472644197601_8700155449427347">&#65279;</span><br/></p>
Following is the method I used to decode HTML in PHP before it returns the data to front end.
<?php
$valueFromDB= "<p>dfgdfgdfgfd</p><p><br/></p><p>dg</p><p>d</p><p>g</p><p><span class="rangySelectionBoundary" id="selectionBoundary_1472644203224_7186990890070339">&#65279;</span>df<span class="rangySelectionBoundary" id="selectionBoundary_1472644203224_09491296280590866">&#65279;</span></p><p><span class="rangySelectionBoundary" id="selectionBoundary_1472644197601_045958185758413816">&#65279;</span>g<span class="rangySelectionBoundary" id="selectionBoundary_1472644197601_8700155449427347">&#65279;</span><br/></p>";
$decoded = html_entity_decode(htmlspecialchars_decode($valueFromDB,ENT_QUOTES));
echo $decoded;
?>
It works in fiddle but in real website, this is how it looks.
Why it's not working in website when it works in a fiddle?
