Ionic framework 如何使textarea在Ionic中显示具有HTML属性的文本?

Ionic framework 如何使textarea在Ionic中显示具有HTML属性的文本?,ionic-framework,ionic2,ionic3,Ionic Framework,Ionic2,Ionic3,我在我的home.html页面上添加了一个文本区域。问题是,如果我通过按enter键按行添加数据,现在当我将其保存在数据库中并显示在页面上时,它只显示一行 我就是这样键入的: 1. Line one 2. Line two 3. Line three 1. Line one 2. Line two 3. Line three <ion-textarea rows="1" autosize #input (click)="focusInput(input)" (input)="chang

我在我的home.html页面上添加了一个文本区域。问题是,如果我通过按enter键按行添加数据,现在当我将其保存在数据库中并显示在页面上时,它只显示一行

我就是这样键入的:

1. Line one
2. Line two
3. Line three
1. Line one 2. Line two 3. Line three
<ion-textarea rows="1" autosize #input (click)="focusInput(input)" (input)="change()" id="messageInputBox"  placeholder="Type Something To Send.." type="text" name="TAG" [(ngModel)]="TAG" style="z-index:9.99999; color:#818993;font-size:18px; ">
</ion-textarea>
页面上就是这样显示的:

1. Line one
2. Line two
3. Line three
1. Line one 2. Line two 3. Line three
<ion-textarea rows="1" autosize #input (click)="focusInput(input)" (input)="change()" id="messageInputBox"  placeholder="Type Something To Send.." type="text" name="TAG" [(ngModel)]="TAG" style="z-index:9.99999; color:#818993;font-size:18px; ">
</ion-textarea>
下面是我的HTML代码:

1. Line one
2. Line two
3. Line three
1. Line one 2. Line two 3. Line three
<ion-textarea rows="1" autosize #input (click)="focusInput(input)" (input)="change()" id="messageInputBox"  placeholder="Type Something To Send.." type="text" name="TAG" [(ngModel)]="TAG" style="z-index:9.99999; color:#818993;font-size:18px; ">
</ion-textarea>


如何解决此问题?

如果在HTML模板中回显标记模型的内容,则应使用类似管道的工具,并按如下方式使用:


请注意,在将HTML回显到页面之前,您还应该对其进行清理。

您可以像这样使用“innerHtml”:但如何使文本以不同的行显示?您能生成一些代码吗?您应该使用这样的代码:
  • 第一行
  • 第二行
  • 第三行
如果您将此字符串用作innerHtml,问题将得到解决!或者你可以使用

但是当我将文本保存到db时,它不是保存新行标记,它只是保存文本,我如何使它保存新行标记,然后我只能使用它。不要保存
标记,每次你向用户显示它时,只需通过nl2br管道输出。好的,我的理解是,让用户在
离子文本区域键入
,我按原样保存。现在,当我显示数据时,我通过管道输出..就这样?如果是的话,我会试试这个,明天再回来汉克斯,它就像一个魔咒,需要更多的指导,我怎样才能让这个链接在div中可以点击,现在还不能点击,有什么建议吗?我不知道你的输出是什么,但我想你可以使用类似管道的东西。