Angular成分HTML逃脱了我的上标



我有一些文本,在Angular 5组件中如下。

区域故障M&Sup2;

不幸的是,Angular打破了我整洁的小平方角色并显示以下内容:

区域故障M& sup2;

component.ts

@Component({
    templateUrl: `component.html`
})
export class SourceDocumentWorkItemsComponent implements OnInit {
    // (all very standard)
}

component.html

<div class="input-group">
    <label class="bold">Area Breakdown m&sup2;</label>
</div>

我如何阻止角度粘合我的html ...我很确定在这里是culprit。

根据您的要求,请尝试使用[innerHTML],而是在下面提供输出:

areaBreakdownText:string='Area Breakdown m&sup2;';
<label class="bold" [innerHTML]="areaBreakdownText"></label>

最新更新