I want to attach an event to the document. when document is clicked I want to remove my directive element. but it is firing for all past instances also.
Below is the code:
link: function(scope, iElement, iAttrs) {
$document.on('click',function(){
iElement.slideUp('fast',function(){
$(this).remove();
});
});
}