Angular filter to replace all underscores to spaces

前端 未结 6 1354
感动是毒
感动是毒 2020-12-18 18:10

I need a filter to replace all the underscores to spaces in a string

6条回答
  •  既然无缘
    2020-12-18 18:50

    In some case, you can use split() function.
    .replace function is not compliant with regexp syntax (i.e. .replace(/,/g,'\n') syntax)

    Full syntax:
    {{myVar.toString().split(',').join('\n')}}

    .toString() function is in case myVar is not typed as String in typescript.

提交回复
热议问题