0

I want to be able to render and display any HTML (even containing javascript), coming from my server, in a dialog popup.

I am using a bunch of different combinations of $compile(...html from server)($scope) and angular.element and I cannot get it to work.

Here is a codepen with some examples.

The second and third buttons fail to produce a dialog as an error is thrown in the angular code.

What am I doing wrong?

Ideally the solution would allow for something like this

...
contentElement: some_func(... some HTML text from the server)
...
6
  • template literals are only for text. Commented Jun 9, 2021 at 19:40
  • @charlietfl "only for text" do you mean "strings"? The first button is an example of passing a string to template:. Otherwise I don't know what your comment is suggesting... Commented Jun 9, 2021 at 20:59
  • popup_html(content) in the codepen is using a template literal ${content} but content is html Commented Jun 9, 2021 at 21:03
  • @charlietfl OK, but am I not passing a string for content every time in the codepen? Commented Jun 9, 2021 at 21:07
  • Yeah I might have overthought it a bit. That Pen is really broken so I didn't stay long Commented Jun 9, 2021 at 21:12

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.