$document.on('click', function (e) {
var clickedOutside = true;
for (var element = e.target; element; element = element.parentNode) {
if (element.className === "header-search-suggest" || element.className === "header-search-suggest-inner") {
clickedOutside = false;
break;
}
}
if (clickedOutside) {
$scope.clearSearch();
$scope.$apply();
}
});