I have a string like this,
var str = '<a src="www.test/data">#data</a> time <a src="www.test/city">#city</a>';
I am using
<div [innerHTML]="str">
It displays but ancholr links are not working.Can anyone please help me.Thanks.
Anchor supports href
attribute not src
, It has nothing to do with Angular. Also make sure URL has protocol mentioned like http
or https
.
<a href="http://www.test/data">#data</a> time <a href="http://www.test/city">#city</a>
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.