A
A
Artem2020-03-25 19:56:43
Angular
Artem, 2020-03-25 19:56:43

How to intercept an event from another Angular 8 component?

Good afternoon!
I am learning Angular and faced such a problem - there is a search-bar component in my project, which has a tag and when you enter text into this field, an event is generated:
<input type="text" (input)="search($event)">

...
@Output()
    input: EventEmitter<any>;
...
search(event): void
    {
        this.input.emit(event.target.value);
    }


What is my problem? In that I can't figure out how I can get this very entered text in another component - someTable.component.ts - and use it in someFunction(){}.
Can someone explain the fool?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Shvets, 2020-03-26
@Malodar

https://habr.com/en/post/471100/

B
babtsoualiaksandr, 2020-03-25
@babtsoualiaksandr

Better look at reactive forms and use RxJS

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question