【问题标题】:Using angular to conditionally hide text content inside of bootstrap tooltip使用角度有条件地隐藏引导工具提示内的文本内容
【发布时间】:2017-02-24 19:22:01
【问题描述】:

我正在使用包含大量动态内容的引导工具提示。我知道您可以在工具提示 data-title 中使用 html,但您似乎不能使用像 ng-if 这样的角度指令

有没有办法做类似的事情:

        <i class="fa fa-question-circle editable-question" bs-tooltip data-

    html="true" data-title="<span ng-if='function == true'> {{obj.field}}
</span> other content that will always be here" >

我无法在data-title 字符串中使用ng-if

有条件地隐藏/显示工具提示内的某些文本内容的最佳方法是什么?

【问题讨论】:

  • data-title="{{function ? 'text' : '' }}"。它对你有用吗?
  • if (function == true) { 'text' } else { 'dog' }
  • @Nick 几乎可以工作,但问题是我需要显示的文本来自范围变量。当我只使用常规文本时它会起作用,但这不起作用:data-title="{{function ? '{{obj.attr}}' : '' }}"
  • data-title="{{function ? obj.attr : '' }}"?

标签: javascript html angularjs twitter-bootstrap tooltip


【解决方案1】:
data-title="{{function ? obj.attr : '' }}"

【讨论】:

    猜你喜欢
    • 2017-04-04
    • 2021-10-19
    • 2021-11-03
    • 1970-01-01
    • 2014-04-18
    • 1970-01-01
    • 1970-01-01
    • 2017-10-25
    • 2020-08-27
    相关资源
    最近更新 更多