答案 0 :(得分:0)
仅将其呈现为纯HTML格式,但使用ng-show
/ ng-if
隐藏它。
然后使用ng-mouseover
+ ng-mouseleave
悬停显示它。
这是最简单的演示:
.ellipsis {
content: attr(data-title);
overflow: visible;
text-overflow: inherit;
background: #191919;
position: absolute;
border-radius: 0.4rem;
padding: 0 .5rem;
white-space: normal;
word-wrap: break-word;
display: block;
color: white;
z-index: 1;
font-size: 12px;
margin-right: 13px;
opacity: 1.1;
margin-top: 0rem;
visibility: visible;
}
<!DOCTYPE html>
<html ng-app>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body>
<div>
<input ng-model="i" ng-mouseover="a=true" ng-mouseleave="a=false" />
<div class="ellipsis" ng-if="a"><b>Hypertext</b> Markup Language</div>
<br>
<br>
<input ng-model="ii" ng-mouseover="aa=true" ng-mouseleave="aa=false" />
<div class="ellipsis" ng-if="aa"><b>Hypertext</b> Markup Language</div>
<br>
<br>
<input ng-model="iii" ng-mouseover="aaa=true" ng-mouseleave="aaa=false" />
<div class="ellipsis" ng-if="aaa"><b>Hypertext</b> Markup Language</div>
<br>
<br>
</div>
</body>
</html>