Can a json string contain HTML tags with it?

后端 未结 4 1349
别跟我提以往
别跟我提以往 2020-12-30 10:41

Consider this my json string,

[{
  \"Mat_id\": \"2\",
  \"Mat_Name\": \"Steel\",
  \"Measurement\": \"mm\",
  \"Description\": \"Steel\"
}]

4条回答
  •  离开以前
    2020-12-30 11:28

    This answer is for >Angular 2 compilation regarding parsing json containing html tags.

    Below is the json containing html tags

    { 
     "data":"highlighting this 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 tag will be printed as it is.

       

    {{titleDetails.what}}

    output : highlighting this in bold.

    But if you use property binding like below it will render the expected output.

       

    Output: highlighting this in bold

提交回复
热议问题