0

I'm creating a bootstrap popover in javascript on an element, and I need to do some work after the popover DOM has been written. I have the following so far.

                // bootstrap popover
                element.popover({
                    title: scope.title,
                    content: content.data,
                    placement: "bottom",
                    html: true
                }).on("show.bs.popover", function () {
                    console.log("this is still before the node is in the DOM");
                });

So i'm setting title, html content, and placement. However, the html content contains an angular <directive> that I wish to $compile() and bootstrap doesn't add the node to the DOM until after the click event.

What I want to do, is when the node appears on the page, run a function that processes the html inside the popover.

Any ideas? Many Thanks

Simon Willan
  • 378
  • 3
  • 14

1 Answers1

0

answering my own question I can do:

.on("shown.bs.popover", function () {
    var id = $(this).attr("aria-describedby");
    var popover = $("#"+id);
});

This gets me the popover html, which I can then run $compile on.

Simon Willan
  • 378
  • 3
  • 14