Created
February 11, 2017 17:56
-
-
Save RosanaRufer/0c240641c05c16f4cc944386e2766256 to your computer and use it in GitHub Desktop.
Hack to configure uibTooltip in config time based on device.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tooltipFactory = $uibTooltipProvider.$get[$uibTooltipProvider.$get.length - 1]; | |
// decorate the tooltip getter | |
$uibTooltipProvider.$get[$uibTooltipProvider.$get.length - 1] = | |
function ( $window, $compile, $timeout, $document, $uibPosition, $interpolate, $rootScope, $parse, $$stackedMap ) { | |
// for touch devices, don"t return tooltips | |
if ("ontouchstart" in $window) { | |
return function () { | |
return { | |
compile: function () { } | |
}; | |
}; | |
} else { | |
// run the default behavior | |
return tooltipFactory( $window, $compile, $timeout, $document, $uibPosition, $interpolate, $rootScope, $parse, $$stackedMap); | |
} | |
}; | |
$uibTooltipProvider.$get.$inject = ["$window", | |
"$compile", | |
"$timeout", | |
"$document", | |
"$uibPosition", | |
"$interpolate", | |
"$rootScope", | |
"$parse", | |
"$$stackedMap"]; | |
$uibTooltipProvider.options({popupDelay: 1000}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment