如何在Ionic 2中打印“%”

时间:2017-03-28 01:28:00

标签: angular ionic-framework ionic2

我正在尝试使%符号出现在前端,但没有任何内容出现。我试过逃避角色,但仍然无效。

this.symbolType == "%";

2 个答案:

答案 0 :(得分:2)

如果是label,则只需这样做。您不需要从.ts文件中传递它。只需直接在html页面内进行操作即可。

 <ion-label>%</ion-label>

更新:您不需要提供this。请按以下方式使用。

<ion-label> {{symbolType}} </ion-label>

Working Plunker

答案 1 :(得分:0)

使用其实体的正确方法。百分比符号为&#37;了解详情http://www.freeformatter.com/html-entities.html

this.symbolType = '%';
this.htmlEntity = this.symbolType.replace('%', '&#37;');