lujakob
1/4/2017 - 12:44 PM

Replace link tag href with angular click handler

Replace link tag href with angular click handler

var text = '<a href="http://www.demo.de">click here</a>';

var regex = /<a href="(.*?)">(.*?)<\/a>/g;
var html = text.replace(regex, '<a href="javascript: return false;" (click)="doLink(\'$1\')">$2</a>');
console.log(html);