javascript - str.replace stripping ng-click in custom filter -
i'm using filter replace urls in string clickable links.
.filter('parseurl', function() { var urls = /(\b(https?|ftp):\/\/[a-z0-9+&@#\/%?=~_|!:,.;-]*[-a-z0-9+&@#\/%=~_|])/gim; var emails = /(\w+@[a-za-z_]+?\.[a-za-z]{2,6})/gim; return function(text) { if(text.match(urls)) { text = text.replace(urls, "<a href=\"$1\" ng-click=\"\$event.stoppropagation()\" target=\"_blank\">$1</a>") } return text } }) i'm trying insert stoppropagation event on ng-click ng-click of parent doesn't take precedent on href, reason ng-click gets stripped everytime. ideas why?
wiki
Comments
Post a Comment