Image somewhere in a text from an array

I want to fetch some texts from an array, according to the election of the user.
Some texts should contain some images at a special position.

It should look similar to this one: = [
      "Some Text <img src='img/img1.jpg'> Image", 
      "Text 2 without image", 
      "Some Text <img src='img/img2.jpg'> with another Image"

Is there a way how I can achieve that? Thank you!

check ng-bind-html.

setup a variable that contains the selected array value and bind it to your html through this method.

Good luck

1 Like

Thank you!

Sounds very interesting! Is it possible that it’s not reallye working in angular 2 anymore?

Tried several tutorials, but sadly no success ;-(

Looks like it.
Hopefully they will include something similar but I do have my security concerns…

I will make an attempt on building a directive to produce basic html markup.
But as we are soon to see angular2 released and I’m in timeshortage now, I want to see first if angular2 comes up with something soon.

If i can help on any of you guys’ attemps let me know. Could be an interesting github project…

Found something: For basic usage [innerHtml] seems to be working (don’t know how far… but enough for my problem right know)

<span [innerHtml]="content"></span>

this.content = "<img src='img/logo.jpg'>";

What beta are you using? It seems to depend on what verion you are running

I’m using
"angular2": "2.0.0-beta.0",

Follow up on this post:

It’s the same topic basically. That way there is 1 thread with all of us cooperating instead of framents all over the forum. If you figure it out, share it as well, so others can be helped.

Cheers and see you on the other post…

Thanks, didn’t find this one!