finished doing it
<a [href]="_service.ifLink(outside,'/route',id,externalUrl)" >Link</a>
and service
public ifLink(outside,internal,internalId, external) {
if(outside)
return external
return `${internal}/${internalId}`
}
URL- temp jQuery ngAfterViewInit click, , -, Angular 2
ngAfterViewInit() {
if (this.replacing)
this.replaceHref()
}
links:any;
replaceHref() {
this.links = $('a')
for (var i = 0; i < this.links.length; i++) {
var extHrefEl = $(this.links[i]).attr('exthref')
if (extHrefEl) {
var extHref = $(this.links[i]).attr('exthref')
$(this.links[i]).attr('href', extHref);
$(this.links[i]).click(function () {
window.location.href = extHref;
});
}
}
}
<a [attr.exthref]="externalUrl" [routerLink]="['/route',id]">Link</a>