Javascript string to html template in Ionic 2


#1

I want to get a javascript string that is created in app.js into a text in my side menu in app.html.

I tried inserting {{ mystring }} in the text, but it doesn’t work. Can you help me? Thanks in advance.


#2

Would something like this do what you want?

<div [innerHTML]="mystring"></div>

#3

Thank you for your reply. It would work, but the problem was, that my string was not right initializied. After solving this, my first try with {{ mystring }} is working too.


#4

What your problem? Use the variables from an another scope? Save the variable to a service.
Or from parent scope? Then you would like to use the object sharing: strings.mystring


#5

Thanks, but I have no problem anymore. It’s solved.