A
A
Anna2020-09-20 13:16:00
Angular
Anna, 2020-09-20 13:16:00

How to make the user panel disappear on click on the external area in angular?

How to make the user panel disappear on click on the external area in angular?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Belyaev, 2020-09-21
@kit91ka

you can hang an event handler on a click, and when the event fires, do something
like onClick($event) {
if (this.userPanel && this.userPanel.nativeElement.contains($event.target)) {
return
}
/// logic on hide panel
}
then you can remove the click handler and hang it when next. times come in handy

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question