I want to display html tags in string format in inner html tag
I have following string
myString = "<span class="display-red"><a href="link"><span>ABC <a href=""></a>PQR</span><span>abc@gmail.com</span></a></span>"
This is my html tag in code (Here I want to render this html tag)
<span [innerHtml]="myString"></span>
Expected Output
ABC <a href=""></a>PQR
abc@gmail.com
I want to display some html tag as it is in my output.
In the html you want to display, replace <
with <
(or >
with >
)
myString = "<span class="display-red"><a href="link"><span>ABC <a href=""></a>PQR</span><span>abc@gmail.com</span></a></span>"
Use <
instead of <
and >
instead of >
. You will get exactly what you want.
Solution:
myString = "<span class="display-red"><a href="link"><span>ABC <a href=""></a>PQR</span><span>abc@gmail.com</span></a></span>"
You should replace the <
with <
and the >
with >
. This will display it as regular text.
You should replace the <
with < and the >
with >
myString = "<span class="display-red">ABC <a href="link"><span><a href=""></a></a>PQR</span><br><span>abc@gmail.com</span></span>"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.