0
0
Angularframework~5 mins

Child to parent communication flow in Angular - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the main way a child component sends data to its parent in Angular?
The child component uses an @Output property with an EventEmitter to send data to the parent component.
Click to reveal answer
beginner
How do you declare an event in a child component to notify the parent?
You declare an @Output() eventName = new EventEmitter<type>(); in the child component class.
Click to reveal answer
beginner
How does the parent component listen to events from the child component?
In the parent template, bind to the child's event like <child (eventName)="parentHandler($event)"></child>.
Click to reveal answer
intermediate
Why is using @Output with EventEmitter better than directly accessing child properties?
It keeps components loosely coupled and follows Angular's unidirectional data flow, making the app easier to maintain.
Click to reveal answer
beginner
What is the role of the $event object in child to parent communication?
$event carries the data emitted by the child component's EventEmitter and is received by the parent's event handler.
Click to reveal answer
Which decorator is used in Angular to send data from a child to a parent component?
A@Output
B@Input
C@ViewChild
D@Injectable
What Angular class is used to emit events from a child component?
AObservable
BEventEmitter
CSubject
DPromise
How does the parent component receive data from the child component's event?
ABy using @Input in the parent
BBy calling a method on the child component directly
CBy binding to the child's event in the template using (eventName)
DBy using a service only
What does the $event variable represent in Angular event binding?
AThe Angular lifecycle hook
BThe parent component instance
CThe child component's template
DThe data emitted by the child component's event
Which of these is NOT a recommended way to communicate from child to parent in Angular?
ADirectly modifying parent properties from child
BUsing event binding in the parent template
CUsing @Output with EventEmitter
DPassing data via emitted events
Explain how a child component sends data to its parent in Angular. Include the decorators and classes involved.
Think about how events work in Angular templates.
You got /4 concepts.
    Describe why using @Output and EventEmitter is a good practice for child to parent communication in Angular.
    Consider component independence and data flow direction.
    You got /4 concepts.