AngularJS - Remove \n from data

后端 未结 6 1841
时光取名叫无心
时光取名叫无心 2021-02-07 20:07

What is the best way to catch and format the \"\\n\\n\" inside of text being passed from the server to display line breaks? Fiddle is here: http://jsfiddle.net/nicktest2222/2vYB

6条回答
  •  逝去的感伤
    2021-02-07 20:14

    You can use ngBindHtmlUnsafe directive, with terms: '...

    ...'

    You can either send the html to the AngularJS, or send the string with \n and replace it with
    in AngularJS's controller. Either way should work. Hope it helps.

    Demo

提交回复
热议问题