O
O
Oleg Morev2020-05-21 17:21:40
Angular
Oleg Morev, 2020-05-21 17:21:40

How to hide a window on click on an area outside of an element (ANGULAR)?

Good evening everyone)
When you click on the button, a window appears, how to hide it by clicking on the area? And still with a condition that in the window it is necessary to leave an opportunity to cause still any functions?
https://codesandbox.io/s/suspicious-mestorf-iz3hy

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
the5x, 2020-05-22
@DpOLEGapx

Something like this
https://codesandbox.io/s/lively-water-vfi0s

E
Eduard07, 2020-05-21
@Eduard07

Example with jQuery.... native js link, How to handle click outside of block?
jQuery(function($){
$(document).mouseup(function (e){ // web document click event
var div = $("#popup"); // set element ID here
if (!div.is (e.target) // if the click was not on our block
&& div.has(e.target).length === 0) { // and not on its children
div.hide(); // hide it
}
});
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question