Replace \n with
tag angular 6

前端 未结 2 602
遥遥无期
遥遥无期 2021-01-17 08:46

I have a REST API with \\n as backslash tags, can angular 6 replace these with
tags?

Here\'s my code:

{{x.deskrips         


        
2条回答
  •  时光取名叫无心
    2021-01-17 09:23

    You don't need a library. Simply set the white-space property of your tag to pre-wrap (or use a

     tag that should have this style by default)

    document.querySelector('#formatted').innerText = 'Lorem\nIpsum';
    #formatted {
      white-space: pre-wrap;
    }
    Lorem\nIpsum

提交回复
热议问题