angularjs
  • tooltip
  • 2015-07-21 89 views 0 likes 
    0

    我想顯示工具提示上傳和下載圖標在我的頁面。 工具提示非常關閉元素。角度ui工具提示出現錯誤的元素位置

    HTML如下:

    <tr ng-repeat="documents in docs" > 
        <td > 
         <a href="#" >{{documents.document_name}}</a> 
         <span tooltip="download" class='glyphicon glyphicon-download-alt'></span> 
        </td> 
    </tr> 
    
    <script> 
        var myApp = angular.module('myApp',['ui.bootstrap']); 
        myApp.controller('secondTrdCtrl', ['$scope','$http','$position',   function($scope,$http,$position) { 
        $scope.docs= [{document_name:"doc1",document_type:"A"}, {document_name:"doc2",document_type:"B"}] 
    }]); 
    </script> 
    

    工具提示會出現,但它似乎幾乎底部的頁面。不只是在下載圖標旁邊。

    我不能在這裏張貼截圖,因爲我的計算器信譽計數是不夠的。

    回答

    0

    但不知道職位的原因。通過使用angular指令和bootstrap [data-toggle =「toggle」]方式找出解決方案。

    <span data=toggle='tooltip' tooltip>download</span> 
    
    <script> 
        $(document).ready(function(){ 
         $('[data-toggle="tooltip"]').tooltip(); 
        }); 
    
        var myApp = angular.module('myApp',['ui.bootstrap']); 
        myApp.directive('tooltip', function(){ 
         return { 
         restrict: 'A', 
         link: function(scope, element, attrs){ 
          $(element).hover(function(){ 
           // on mouseenter 
           $(element).tooltip('show'); 
          }, function(){ 
           // on mouseleave 
           $(element).tooltip('hide'); 
          }); 
          } 
         }; 
        }); 
    </script> 
    
    相關問題