2016-09-14 21:09:55 +08:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ngdoc directive
|
|
|
|
* @name passmanApp.directive:passwordGen
|
|
|
|
* @description
|
|
|
|
* # passwordGen
|
|
|
|
*/
|
|
|
|
angular.module('passmanApp')
|
|
|
|
.directive('tooltip', ['$window', function ($window) {
|
|
|
|
return {
|
|
|
|
restrict: 'A',
|
|
|
|
scope: {
|
|
|
|
tooltip: '=tooltip'
|
|
|
|
},
|
|
|
|
|
|
|
|
link: function (scope, el, attr, ctrl) {
|
2016-09-15 04:50:14 +08:00
|
|
|
scope.$watch('tooltip', function (newVal, old) {
|
|
|
|
if (scope.tooltip) {
|
|
|
|
$(el).attr('title', scope.tooltip);
|
|
|
|
$(el).tooltip();
|
|
|
|
$(el).attr('title', scope.tooltip).tooltip('fixTitle');
|
2016-09-15 06:11:59 +08:00
|
|
|
$('.tooltip-inner').text(scope.tooltip); // Dirty hack
|
2016-09-15 04:50:14 +08:00
|
|
|
if($(el).is(':visible')){
|
2016-09-15 06:11:59 +08:00
|
|
|
//$(el).tooltip('show')
|
2016-09-15 04:50:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2016-09-14 21:09:55 +08:00
|
|
|
})
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}]);
|