I use angular-ui tooltips (https://github.com/angular-ui/bootstrap/blob/master/src/tooltip/tooltip.js) or angular strap tooltip (http://mgcrea.github.io/angular-strap/#/tooltips#tooltips)
I need show tooltip on element, when the some event or expression.
Example below, we have the input. And i need to show tooltip, when data.model.count == 5. And then hide tooltip of beyond the 5 second. Help me please!
<input type="text" ng-model="data.model">
Write a directive! plunker
angular.module('ui.bootstrap.demo').directive('showTip', function($timeout){
return {
restrict: 'A',
scope: {
showTip: "="
},
link: function(scope, elm, attr){
var tooltip;
scope.$watch('showTip', function(newVal){
if(newVal == 5){
tooltip.css({visibility: 'visible'});
$timeout(function(){
tooltip.css({visibility: 'hidden'});
}, 5000)
}
})
elm.bind('DOMSubtreeModified', function(){
tooltip = elm.find('div');
tooltip.css({visibility: 'hidden'});
})
}
}
});