app.directive(function($document) {
var onDocumentClick = function(event) {
var isChild = element.find(event.target).length > 0;
if (!isChild) {
scope.openFilterFlag = false;
scope.$apply();
}
}
$document.on('click', onDocumentClick);
element.on('$destroy', function() {
$document.off('click', ondocumentClick);
});
});