I have a Cordova app written in Angular 2 that allows the user to send links/url between users. When the user for example enters www.google.com and send it to other users we have to make it clickable. And for that I use RegEx, this is what it lookes likes when the url starts with www:
replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
replacedText = regexpStr.replace(replacePattern2, '<a href="http://$2"
(click)="openLink2(replacePattern2)" target="_system" class="link-
style">$2</a>');
In the component where the user is going to click on the link the openLink2 function looks like this:
openLink2(url2) {
window.open(url2, '_system', 'location=yes,
closebuttoncaption=Return');
}
The problem is that when the HTML compiles the (click)="openLink2(replacePattern2)" is gone. Is there anyway that replacePattern2 is removing "(click)" from the string? How can I solve this problem so the user can open the link in systems browser in Cordova??