【问题标题】:Show angular ui tooltip after ng-model-debounce?在 ng-model-debounce 之后显示角度 ui 工具提示?
【发布时间】:2015-12-14 11:05:35
【问题描述】:

我想在 ng-model-options debounce 完成后显示一个 angular-ui 工具提示。它应该在模糊时显示并在焦点上隐藏。

<input type="email"
 name="email" 
 ng-model="ctrl.email"
 ng-model-options="{ debounce: 500 }"
 tooltip="Not valid"
 tooltip-trigger="blur"
 tooltip-enable="
 {[ 
   form.email.$invalid && 
   form.email.$dirty && 
   !form.email.$pending
 ]}">

我不知道如何处理这个单独的自定义指令:

scope.$watch(function () {
    return ngModel.$viewValue;
}, function () {

   if (attrs.boTooltipToggle === 'true') {
       attrs.tooltipTrigger = 'blur';
   } else {
       attrs.tooltipTrigger = 'focus';
   }
});

问题是工具提示被立即触发(显示),但我的异步验证在 500 毫秒去抖动时间后开始运行。我想在异步验证完成后触发/显示工具提示。你有什么想法可以很好地解决这个问题吗?

【问题讨论】:

    标签: angularjs


    【解决方案1】:
    1. 将 ID 放入输入中。

    2. 您的观察者目前未设置观看任何内容。

      $scope.$watch("idValue", function () { // code ... });

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-04
      • 1970-01-01
      • 1970-01-01
      • 2015-07-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多