Consider this my json string,
[{
\"Mat_id\": \"2\",
\"Mat_Name\": \"Steel\",
\"Measurement\": \"mm\",
\"Description\": \"Steel\"
}]
This answer is for >Angular 2 compilation regarding parsing json containing html tags.
Below is the json containing html tags
{
"data":"highlighting <b>this</b> in bold"
}
As you can see this is the keyword need to be bold in html while rendering.
If I use angular interpolation like below it will be parsed as normal string and <b> tag will be printed as it is.
<p> {{titleDetails.what}}</p>
output : highlighting <b>this</b> in bold.
But if you use property binding like below it will render the expected output.
<p [innerHTML]="titleDetails.what"></p>
Output: highlighting this in bold
Yeah.. no problem with that. :)
Technically, yes, you can do that... practically, I'd be a bit concerned if there were HTML markup in my data. What else might be in there? Smells like an XSS vulnerability.
use Encoder.js from http://code.google.com/p/jsool/source/browse/jsool-site/js/util/Encoder.js?r=176
when getting data use
Encoder.htmlDecode(value);
and when passing data use
Encoder.htmlDecode(value);