Angular Dropdown Menu Close On Click Outside

Angular Dropdown Menu Close On Click Outside

Monsterlessons Academy

2 года назад

22,292 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

SHANMUGAKAMALESH M
SHANMUGAKAMALESH M - 24.09.2023 08:09

Thanks dude ❤

Ответить
Pepik Mac Ten
Pepik Mac Ten - 12.09.2023 00:41

Thank you SO much!

Ответить
Gabriel Reguera
Gabriel Reguera - 11.09.2023 21:09

What to do when I use a dropdown with position absolute? it does not work

Ответить
Guillermo Sandoval
Guillermo Sandoval - 15.08.2023 19:40

Thanks a lot!!!

Ответить
Hashir Ali
Hashir Ali - 13.05.2023 13:30

thank u so much buddy i was stuck on this for a week <3 much love

Ответить
Federico Balboa
Federico Balboa - 27.04.2023 02:48

you're the boss! thanks

Ответить
Chutinun (Bell) Tantasathiar
Chutinun (Bell) Tantasathiar - 26.04.2023 06:39

thank you very much, great video for angular for beginner

Ответить
luczztem
luczztem - 31.03.2023 01:52

and again you are my hero! thank you so much bro after 2 days searching for anything that worked for what I needed, this was the only solution! thanks a lot!!!

Ответить
Rob G
Rob G - 02.02.2023 05:07

filter(event) is deprecated

Ответить
Automobili
Automobili - 31.01.2023 21:34

Thank you very much for this tutorial.

Ответить
Andrei Filimonchyk
Andrei Filimonchyk - 20.01.2023 17:10

Thanks. the problem is solved!

Ответить
Sumit Ghewade
Sumit Ghewade - 21.12.2022 00:57

This video really helped me a lot.

Ответить
Dror Handler
Dror Handler - 11.12.2022 18:38

First thank you for the video, i'm getting deprecated on the event that the method filter is getting, how can i fix it?

Ответить
Denis Varaksin
Denis Varaksin - 02.12.2022 03:31

Thank you for your tutorial, clean RxJS usage on this one!

Ответить
martin-dw
martin-dw - 01.12.2022 19:18

I have problem.
I try this but is not working, the styles are in the global CSS, the directive is on the app folder and the directive is the same of yours but it doesnt work. I dont know exactly why this isn't working, can you please give me some advice or a clue that what could be the problem?

Ответить
Prashant Singh
Prashant Singh - 17.11.2022 10:46

Thank you so much, It helped a lot.

Ответить
Student Learning Informatic
Student Learning Informatic - 13.11.2022 18:04

wich theme is used for writing code ?

Ответить
learn programming in odia
learn programming in odia - 04.11.2022 21:07

Sir, if I used same drop-down in more than two times means I want more drop down in same page then this outside click directive is not working

Ответить
pasha vibe
pasha vibe - 08.08.2022 11:53

greatable thanx for your channel! remark - this way doesn't work for elemnts if their parent have ViewEncapsulation.ShadowDom

Ответить
Robert Parker
Robert Parker - 12.07.2022 22:17

:thumbs up

Ответить
Kurt Khalid Israel
Kurt Khalid Israel - 12.07.2022 21:17

Thank you very much, I'm a beginner with angular and this helped with my particular use case in my own project! I wish there were more content like this with angular that's freely available.

Ответить
Mat H
Mat H - 04.07.2022 14:32

great video, thanks a lot -- i'd also have one question: within the dropdown i have some buttons with click events like <button type="button" (click)="doSomething()" ...
If i click those buttons, the dropdown also closes. any recommendation on how to avoid that? Thanks!

Ответить
Tech Adi Views
Tech Adi Views - 17.06.2022 17:32

nice video, one doubt I have, what if we have multiple main menu, then if you click any menu all are showing simultaneously. can you plz send me the code?

Ответить
sudhakar gajja
sudhakar gajja - 17.06.2022 13:10

For me it's showing error at this.documentClickSubscription?. unsubscribe ();

Showing that expected ":" at above line in my project

Ответить
Viacheslav Pak
Viacheslav Pak - 14.06.2022 02:45

this video is a MUST to watch! thank you

Ответить
Mayron Alves
Mayron Alves - 03.06.2022 01:24

TU ME SALVOU DEMAIS, OBRIGADOOOO

Ответить
Egon Knapen
Egon Knapen - 02.06.2022 16:20

I like your version with fromEvent.

The biggest problem I do however have, with this idea, is that if you have, say like 100 elements with clickoutside directives on your page, all those 100 elements will be triggered when you click somewhere. So shouldn't you somehow, disable that subscription and only check, when the menu is opened?

Ответить
OnlyDev
OnlyDev - 02.05.2022 06:58

thanks you helped me a lot

Ответить
Raphael Rodrigues Coelho
Raphael Rodrigues Coelho - 31.03.2022 19:33

Thanks very much for this video! That really help me today at work :)

Ответить
Naveen pisher
Naveen pisher - 26.03.2022 19:02

Very helpfull content, Thank you so much for doing this. Really Appreciated Sir.

Ответить
Ville Madison
Ville Madison - 25.03.2022 14:52

Doing that manual unsubscription seems heavy to me. I would make a BaseComponent that implements OnDestroy having a var of smth ngUnsubscribe: Subject. In that BaseComponent ngOnDestroy function write 2 lines: this.ngUnsubscribe.next() and this.ngUnsubscribe.complete().

Now when developing components extend that BaseComponent and each subscription that needs to be destroyed have a pipe of ...pipe(takeUntil(this.ngUnsubscribe)).

Now all of your subscriptions are killed when your component get's destroyed. No more headache of memory leak via subscriptions :)

Ответить
Alaa Khalila
Alaa Khalila - 25.03.2022 13:20

What about host listener?

Ответить
Foo
Foo - 24.03.2022 20:17

you're saving lives mate

Ответить
Sergey Pugach
Sergey Pugach - 24.03.2022 18:55

Great video, it would be nice to have more content like this with Angular

Ответить
Sunny Vakil
Sunny Vakil - 24.03.2022 17:56

Helpful video, thank you !

Ответить