You are developing an Angular application where a child component needs to notify its parent component about certain events. Which mechanism would you use?

  • @Input and @Output
  • EventEmitter
  • Subject
  • ngModelChange Event
To have a child component notify its parent in Angular, you typically use the @Input and @Output decorators. The child component can send data or events to the parent component using @Output, creating a custom event emitter. EventEmitter can be used, but it's often associated with custom events. Subjects are used for more complex scenarios. The ngModelChange event is used for form input changes, not parent-child communication.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *