Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert a string into a HTML element in Mithril?

Suppose I have a string <span class="msg">Text goes here</span>.I need to use this string as a HTML element in my webpage. Any ideas on how to do it?

like image 200
Mohit Avatar asked Mar 15 '23 23:03

Mohit


1 Answers

Mithril provides the m.trust method for this. At the place in your view where you want the HTML output, write m.trust( '<span class="msg">Text goes here</span>' ) and you should be sorted.

like image 130
Barney Avatar answered Mar 19 '23 05:03

Barney