I am creating a single page app with a lot of tooltips and pop ups on different areas. I am closing those elements by checking where the click is happening. for exmaple something like:
$scope.popup1 = {
open: function(){
$scope.popup1Open = true;
$timeout(function(){
$document.bind('click',function(e){
if(!angular.element('#popup1-container').find(e.target).length) {
// if in directive, ill use: $elem.find(e.target).length
$timeout(function(){
$scope.popup1.close();
$scope.$apply();
});
}
});
});
},
close: function () {
$scope.popup1Open = false;
}
}
Now like I said I have multiple popups happening, which can be opened at different areas of the page. They all have their own ids and some in their own directives. So I'm creating $document.bind('click')
each time when a popup opens, and I'm not going to bother unbinding it because it will a) affect the other popups and also the popups are accessed so many times for very key areas.
So my question is, are there any performance issue that might come up with what I'm doing?