【问题标题】:Angular: Tooltip not showing upAngular:工具提示未显示
【发布时间】:2015-01-23 17:22:37
【问题描述】:

这是生成的 DOM:

<input class="form-control col-md-11 input ng-scope ng-animate ng-dirty ng-valid-required ng-invalid ng-invalid-minlength" type="password" value="" placeholder="*******" ng-model="user.confirmpassword" required="required" maxlength="80" autocomplete="off" ng-minlength="6" tooltip="Passwords do no match" tooltip-trigger="true" tooltip-placement="right" style="-webkit-transition-timing-function: initial, initial; transition-timing-function: initial, initial; -webkit-transition-delay: initial, initial; transition-delay: initial, initial;">

在 HTML 中:

&lt;div class="col-md-9 text-left"&gt;&lt;input class="form-control col-md-11 input" type="password" Value="" placeholder="*******" ng-model="user.confirmpassword" required="required" maxlength="80" autocomplete="off" ng-minlength="6" tooltip="Passwords do no match" tooltip-trigger="{{user.password !== user.confirmpassword}}" tooltip-placement="right"&gt;&lt;/div&gt;

工具提示触发器为真,但仍然没有工具提示的迹象。有什么,我做错了吗?

【问题讨论】:

  • 页面上是否还有其他工具提示?我只能猜测你没有在页面上包含正确的 js/css。
  • @Scott 简短回答是。我有一个,但那不是一个表情。这是一个直接的。没有表情。

标签: angularjs twitter-bootstrap tooltip


【解决方案1】:

我相信 tooltip-trigger 并不是一个真/假,而是一个事件。对真/假的快速测试似乎不起作用。一个更简单的解决方案是这样的。

  <input ng-model="password" tooltip="{{theTooltip()}}">
  <input ng-model="matchPassword" tooltip="{{theTooltip()}}">

  $scope.password;
  $scope.matchPassword;
  $scope.theTooltip = function() {
            if($scope.password == $scope.matchPassword) {
                return "matching";
            } else {
                return "not matching";
            }
  };

【讨论】:

  • 是的。你说的对。它不适用于真/假。我遇到的问题是工具提示仅适用于focusblurmouseentermouseleave,然后才显示工具提示,而不仅仅是表达式。因此,它在少数情况下有效,而在其他时候无效。感谢您的意见。
猜你喜欢
  • 2020-02-12
  • 1970-01-01
  • 1970-01-01
  • 2011-01-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多