This is a follow-up question to this question: AngularJS input with focus kills ng-repeat filter of list
Basically my code is using AngularJS to pop-out a div (a dra
I suggest to add $event.stopPropagation(); on the view right after on the ng-click. You don't need to use jQuery.
Then, you can use this simplified js.
$scope.toggleSearch = function () {
$window.onclick = null;
$scope.menuOpen = !$scope.menuOpen;
if ($scope.model.menuOpen) {
$window.onclick = function (event) {
$scope.menuOpen = false;
$scope.$apply();
};
}
};