How to get line break within string interpolation in Angularjs

前端 未结 5 1881
萌比男神i
萌比男神i 2021-01-05 10:15

So I\'m trying to do something very simple and I\'m stuck. I have a String variable and within that variable I Wanna set line break so certain part of the text

5条回答
  •  情书的邮戳
    2021-01-05 11:03

    In html add style:

    {{DialogText}}

    Use '\n' to add newline in the typescript.

    this.DialogText = "Hello" + '\n' + "World";
    

    Same in stackblitz: https://stackblitz.com/edit/angular-rpoxr5linebreak

提交回复
热议问题