Why md tooltip is not applied to md dummy tab

I am using angular material.

When I create my own directive and add it to md-tab-label, like

<md-tab-label>
<custom-directive>
Label
</cutom-directive>
</md-tab-label>

Then the custom directive is applied to some "md-dummy-tab" also.

But if I give mdtooltop to the md-tab-label ,like

<md-tab-label>
Label
<md-tooltip>Label</md-tooltip>
</md-tab-label>

then there is no md-tooltip applied to "md-dummy-tab" class

I tried searching inside the mdtooltip code, but couldnt get any clue.

https://github.com/angular/material/blob/master/src/components/tooltip/tooltip.js

How can I do the same for my custom directive , ie custom directive should not apply to md dummy tab?


<md-tooltip> is not appended to the <md-dummy-tab> because it doesn't render any HTML code inside the <md-tab-label> . Its template is appended to the nearest parent <md-content> the moment you trigger the tooltip to show.

  scope.$watch('visible', function (isVisible) {
    if (isVisible) showTooltip();
    else hideTooltip();
  });

-

function showTooltip() {
  // Insert the element before positioning it, so we can get the position
  // and check if we should display it
  tooltipParent.append(element);

  // Check if we should display it or not.
  // This handles hide-* and show-* along with any user defined css
  if ( hasComputedStyleValue('display','none') ) {
    scope.visible = false;
    element.detach();
    return;
  }

  positionTooltip();
  angular.forEach([element, background, content], function (element) {
    $animate.addClass(element, 'md-show');
  });
}

-

current       = getNearestContentElement(),
tooltipParent = angular.element(current || document.body)

-

 function getNearestContentElement () {
   var current = element.parent()[0];
   // Look for the nearest parent md-content, stopping at the rootElement.
   while (current && current !== $rootElement[0] && current !== document.body) {
     current = current.parentNode;
   }
   return current;
 }
链接地址: http://www.djcxy.com/p/27288.html

上一篇: Django manytomany领域,如何获得80%的子集/比赛检查?

下一篇: 为什么md工具提示未应用于md虚拟选项卡