使用 Angular 值输入:使用换行符将数组列表拆分为单独的项目

Use Angular Value Input: Split Array List into Separate Items using New Line Character

我有一个物品清单。 我试图用分隔符将它们分开。 它使用分号,但不使用换行符。我该如何解决这个问题,以使用新线路? 想显示换行符。

这个有效:

[value]="productList.join('; ')"

不适用于

[value]="productList.join('\n ')"
[value]="productList.join('\r ')"
[value]="productList.join('\n\r ')"

目前正在使用 Angular 8 和 Typescript。

资源:JavaScript Newline Character

它应该可以工作,创建一个 css class with white-space

HTML:

[value]="productList.join('\n ')"

CSS:

.test{
  white-space: pre !important;
}