In my application I have a which I am using to keep a log of events.
It is currently using ng-sanatize as such:
<div ng-bind-html="{{eventLog}}></div>
This works great. I am able to pre-pend eventLog with a HTML message and have it output in the div.
I would like to upgrade this div to allow me to pass in directive that I am using to show a full event trace in another area of the application.
anEvent = { type: "Event", message: "A long event message" }
<logEvent event="{{anEvent}}"></logEvent>
Which outputs
<div class="event">Event</div>
<div class="message">A long event message</div>
I thought that I should be able to simply write
eventLog = "<logEvent event=\"' + customEvent + '\"></logEvent>"
or even
eventLog = "<logEvent event=\"{{customEvent}}\"></logEvent>"
and have everything work. This appears to not be the case.
I tried playing around with a directive that would compile the code based on the solution in another question (How to make ng-bind-html compile angularjs code) in a jsFiddle, but have been unable to figure out how to get this to work.
https://jsfiddle.net/979mN/473/
Can anyone point out what I am doing wrong?