我已经实现了ngx-bootstrap的工具提示,工具提示在正常情况下工作正常。但我想在有条件的基础上显示工具提示。
当我包含isDisabled属性时,我在以下任何一种情况下都看不到工具提示。我错过了什么吗?
<span tooltip="{{toolTipText}}" triggers="" #pop="bs-tooltip" placement="bottom" isDisabled="true"></span>
<button type="button" (click)="toggleSelect()" (mouseenter)="pop.show()" (mouseleave)="pop.hide()">
<span class="pull-left">Click Here!</span>
</button>
(要么)
<span tooltip="{{toolTipText}}" triggers="" #pop="bs-tooltip" placement="bottom" isDisabled="false"></span>
<button type="button" (click)="toggleSelect()" (mouseenter)="pop.show()" (mouseleave)="pop.hide()">
<span class="pull-left">Click Here!</span>
</button>
您需要使用[bracket syntax]
将输入参数评估为javascript而不是静态值。
意思是你需要做[isDisabled]="false/true"
instead的isDisabled="false/true"
。做后面的例子实际上会传入字符串'true'或'false'
这是一个有效的PLUNKER
<div style="margin: 100px;">
<button type="button" class="btn btn-default btn-secondary"
tooltip="isDisable = true"
[isDisabled]="true"
placement="top">
isDisable = true
</button>
</div>
<div style="margin: 100px;">
<button type="button" class="btn btn-default btn-secondary"
tooltip="isDisable = false"
[isDisabled]="false"
placement="top">
isDisable = false
</button>
</div>