C
C
Coder3212016-11-25 14:20:54
Angular
Coder321, 2016-11-25 14:20:54

Angular 2 click outside of component?

I have two components, parent and child. On the parent there is a form with inputs, under the input there is a child component, something like an autocomplete to the input. I need to open and close this dropdown by clicking on the input. There are no problems with this. But you also need to close the input when clicking outside the dropdown. And here is the problem, a click on the input is already considered a click outside the dropdown and the dropdown does not open. How to get around this problem? (I don't think this is a problem though, and Anguar 2 has solutions for that)
Not a great plunker example: https://plnkr.co/edit/0Y1VtQ9CPoBB9kfsE8XG?p=preview

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lenar Mutigullin, 2016-11-25
@NardM

Need to do a two-way binding, explained in detail here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question