I’m not able to get custom attributes to show up using ng-bind-html.
How can I modify the bind-html within angular/ionic to allow ng-click? That would really be my best option regardless of the potential (no potential) for nefarious deeds by the source.
I think you guys probably already solved this, but for the benefit of anyone else that was looking at this thread, I wrote a filter that calls inline javascript on the url of a link. It’s not using angular, but IMO its easier than writing a whole custom directive just to modify your link.
myApp.filter('hrefToJS', function ($sce, $sanitize) {
return function (text) {
var regex = /href="([\S]+)"/g;
var newString = $sanitize(text).replace(regex, "onClick=\"window.open('$1', '_blank', 'location=yes')\"");
return $sce.trustAsHtml(newString);
}
});