angularjs newline filter with no other html

后端 未结 7 1095
北恋
北恋 2020-12-07 14:14

I\'m trying to convert newline characters (\\n) to html br\'s.
As per this discussion in the Google Group, here\'s what I\'ve got:



        
7条回答
  •  情书的邮戳
    2020-12-07 14:39

    Maybe you can achieve this only with html, a way ? It will avoid from using filters or do any kind of processing.

    All you have to do is display the text within an element that has this CSS:

    {{ MyMultiLineText}}

    This will parse and display \n as new lines. Works great for me.

    Here, a jsFiddle example.

提交回复
热议问题