目前,ng-bootstrap允许使用ng-template在工具提示和弹出窗口上绑定HTML (参见example - https://ng-bootstrap.github.io/#/components/tooltip/examples)。
但我找不到一种方法来为ngb-alert做这件事--有支持它的吗?我需要能够在警报消息中显示自定义超文本标记语言(包括用户定义的指令),而innerHTML不能做到这一点,因为它不编译用户定义的指令
发布于 2018-02-15 16:25:22
我不确定,但我想你总能做到
<ngb-alert [dismissible]="false">
<app-my-component></app-my-component>
</ngb-alert>
或
<ngb-alert [dismissible]="false">
<div [innerHtml]="myContent"></div>
</ngb-alert>
发布于 2018-07-12 03:59:49
我不确定这是否有帮助,但我可以通过使用以下内容在我的邮件中使用自定义HTML:
<div #alertsArea tabindex="0" *ngFor="let alert of alerts">
<ngb-alert type="success" tabindex="0" autofocus (close)="removeAlert(alert)">
<h4>{{alert.type}}</h4>
<ul>
<li>{{alert.message}}</li>
</ul>
</ngb-alert>
</div>
这使我可以将消息放入UL/LI组合中,并将消息类型放入标题中。
https://stackoverflow.com/questions/48802717
复制相似问题