I've got a web app where the user's can enter 'rich text' content (tinymce) and have possibly entered hyperlinks. In my angular app, I'm rendering this in a div with ng-bind-html-unsafe to preserve all formatting. I would like to attach an 'ng-click' to any an all a hrefs in that content. I created a filter that parses the content and adds the 'ng-click' text to the resulting html. I interrogated the DOM and see the ng-click="alert('test')" but there's something I'm missing where the output from the filter isn't being "wired up" (compiled).

有帮助吗?

解决方案

The real answer is I needed to be doing this in a directive, not a filter. Roy's link https://stackoverflow.com/a/13405548/295797 provided the necessary guidance. [answering own question to clear from 'unanswered' queue]

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top