@Output Decorator and EventEmitter | Share Data in Angular Application | Child to Parent Component

Опубликовано: 21 Июнь 2024
на канале: XAdmin
109
3

In this video, we are going to understand Data sharing in angular component from one component to another component | from child component to parent component using @Output decorator and EventEmitter

Q. What is Data Sharing between Angular Components?
Data sharing between components in Angular tell to exchange data between them.
Another way we can say to transfer data from one component to another.
This is important when developing interactive and dynamic applications, as components are usually required to communicate and exchange data to perform their functions.

Q. Ways to Share Data Between Angular Components?
There are four Methods to Share Data between Angular Components:
1. Parent-to-Child: Sharing Data via @Input
2. Child-to-Parent: Sharing Data via @Output() and EventEmitter
3. Unrelated Components: Sharing Data via a Service
4. Child-to-Parent: Sharing Data via ViewChild

Child-to-Parent: Sharing Data via @Output() and EventEmitter
@Output is a component decorator that becomes the output for the parent component.
EventEmitter is something that can propagate the event from the child component to the parent component.
In the parent, we will create a function to receive the message and set it equal to the message variable.
In the child, we declare a messageEvent variable with the Output decorator and set it equal to a new event emitter.

#Angular
#AngularFramework


Смотрите видео @Output Decorator and EventEmitter | Share Data in Angular Application | Child to Parent Component онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь XAdmin 21 Июнь 2024, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 10 раз и оно понравилось людям.