[英]How to attach NGBootstrap tooltip to font awesome icon
嘗試在Angular頁面中的字體真棒圖標中添加工具提示。 普通的Bootstrap方法似乎被忽略了,因此我嘗試使用NGBootstrap方法來向按鈕添加工具提示,但該工具提示從不顯示。 https://ng-bootstrap.github.io/#/components/tooltip/examples
典型的Bootstrap方法會導致以下錯誤:懸停時無法設置未定義的屬性“ title”。
<i class="fa fa-info-circle" data-toggle="tooltip" title="Name here"></i>
在組件中:
ngafterviewinit() {
$(function() {
$('[data-toggle="tooltip"]').tooltip();
}
};
這似乎可行:
<i id="icon" class="fa fa-1x fa-info-circle" [ngClass]="icon" aria-hidden="true" placement="right" ngbTooltip="tipContent"></i>
您也可以嘗試使用按鈕標簽。
<div class="infoCSSClass">
<button class="icon-info" data-container="body" ngbTooltip="Here is tooltip text" #toolTip="ngbTooltip" (click)="toolTip.open()" placement="top"></button>
</div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.