refactor vnTooltip
This commit is contained in:
parent
027c19f5c5
commit
b5611d0cc5
|
@ -34,11 +34,12 @@ function tooltip($document, $compile, $interpolate, $sce, $templateCache, $http,
|
|||
return {
|
||||
restrict: 'A',
|
||||
priority: -1,
|
||||
link: function(scope, element, attrs) {
|
||||
var tipHtml = '<div class="mdl-shadow--2dp" ng-class="tipClass"><div class="tooltip-text" translate>{{text}}</div><div ng-if="isHtmlContent" ng-bind-html="htmlContent"></div><div class="tooltip-arrow"></div></div>';
|
||||
var tip;
|
||||
var tipClassName = 'tooltip';
|
||||
var tipActiveClassName = 'tooltip-show';
|
||||
link: function($scope, element, attrs) {
|
||||
let tipHtml = '<div class="mdl-shadow--2dp" ng-class="tipClass"><div class="tooltip-text" translate>{{::text}}</div><div ng-if="isHtmlContent" ng-bind-html="htmlContent"></div><div class="tooltip-arrow"></div></div>';
|
||||
let tip;
|
||||
let tipClassName = 'tooltip';
|
||||
let tipActiveClassName = 'tooltip-show';
|
||||
let scope = $scope.$new();
|
||||
|
||||
scope.tipClass = [tipClassName];
|
||||
scope.text = attrs.vnTooltip || '';
|
||||
|
@ -116,6 +117,7 @@ function tooltip($document, $compile, $interpolate, $sce, $templateCache, $http,
|
|||
|
||||
element.on('$destroy', function() {
|
||||
tip.remove();
|
||||
scope.$destroy();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue