How to pass two parameters to EventEmitter in Angular 9 ? Last Updated : 05 Jun, 2020 Comments Improve Suggest changes Like Article Like Report In Angular, we can transmit the data in both directions i.e. inside: to the child component and outside: to the parent component. For sending data to the child component, we use property binding and for the latter we use EventEmitter. In this article, we will talk about the EventEmitter directive and how can we pass 2 parameters in it. Let's take a look at EventEmitter source code: javascript export declare class EventEmitter<T> extends Subject<T> { __isAsync: boolean; constructor(isAsync?: boolean); emit(value?: T): void; subscribe( generatorOrNext?: any, error?: any, complete?: any): any; } It is clearly visible that in the emit method only one parameter of type T can be passed, so we cannot pass two parameters directly into it. Instead, we can make an object containing all the parameters and pass the object as a single entity. Approach: EventEmitter allows us to emit any type of object, so we will take advantage of it.For passing the parameters, we will wrap all the parameters inside the curly brackets (this will combine them as a single object) and pass it to the emit method.To receive the parameters in the parent component, we will make a similar type of object and update its value with that of the received object. Syntax: @Output() sendobject = new EventEmitter<any>(); this.sendobject.emit({stringval, numval, ...}); Example: We will create two properties in child component and receive them in parent component by using EventEmitter. Code for the child component: javascript import { Component, OnInit, EventEmitter, Input, Output } from '@angular/core'; @Component({ selector: 'app-test', template: ` <h2>child component<h2> <h4>{{name}}</h4> <h4>{{age}}</h4> <button (click) = "send_name_age()">send data</button> `, styles: [] }) export class TestComponent { constructor() { } public name = "geek2"; public age = 22; /* we will define the type of the an object that will be emitted.*/ @Output() public data = new EventEmitter<{name:string, age:number}>(); send_name_age() { /* we will wrap the parameters to be sent inside the curly brackets.*/ this.data.emit({name:this.name, age:this.age}); } ngOnInit(): void { } } Code for the parent component: javascript import { Component } from '@angular/core'; @Component({ selector: 'app-root', template: ` <div style="text-align: center;" > <h1>parent component</h1> <h2>{{model.name}}</h2> <h2>{{model.age}}</h2> </div> /* The data that is sent by the child component will be received in the */ /* Parent component as a parameter for change_name_age method. */ <app-test (data) = "change_name_age($event)" > </app-test> `, styleUrls: [] }) export class AppComponent { /* Create a model of the type that is emitted by the child component to receive it.*/ public model = { name: "geek1", age: 24 } change_name_age(data) { /* Update the current model with the value sent by the child component. */ this.model = data; } } Output: Successfully received both age and name from child component in the parent component. Before receiving name and age: Before receiving data Name and age in the parent component is updated after receiving it from child component.After receiving data Create Quiz Comment V vaibhav19verma Follow 0 Improve V vaibhav19verma Follow 0 Improve Article Tags : Web Technologies AngularJS AngularJS-Misc Explore AngularJS BasicsAngularJS Tutorial 5 min read Introduction to AngularJS 4 min read Angular CLI | Angular Project Setup 3 min read AngularJS Expressions 2 min read AngularJS Modules 3 min read AngularJS ng-model Directive 4 min read AngularJS Data Binding 4 min read AngularJS Controllers 3 min read AngularJS | Scope 2 min read AngularJS Services 4 min read AngularJS | AJAX - $http 3 min read AngularJS | Tables 2 min read AngularJS Select Boxes 2 min read AngularJS SQL 3 min read AngularJS HTML DOM 2 min read AngularJS Events 3 min read AngularJS | Forms 3 min read AngularJS Form Validation 3 min read AngularJS | API 2 min read AngularJS and W3.CSS 2 min read AngularJS Includes 3 min read AngularJS Animations 1 min read AngularJS | Application 3 min read AngularJS DirectivesAngularJS Directives 9 min read AngularJS ng-app Directive 1 min read AngularJS ng-bind Directive 2 min read AngularJS ng-bind-html Directive 2 min read AngularJS ng-bind-template Directive 2 min read AngularJS ng-blur Directive 1 min read AngularJS ng-change Directive 2 min read AngularJS ng-checked Directive 2 min read AngularJS ng-class Directive 2 min read AngularJS ng-class-even Directive 2 min read AngularJS ng-class-odd Directive 2 min read AngularJS ng-click Directive 2 min read AngularJS ng-cloak Directive 2 min read AngularJS ng-controller Directive 2 min read AngularJS Directives Complete Reference 2 min read AngularJS FiltersAngularJS | Filters 7 min read AngularJS currency Filter 2 min read AngularJS | date Filter 2 min read AngularJS filter Filter 3 min read AngularJS json Filter 2 min read AngularJS limitTo Filter 2 min read AngularJS lowercase Filter 1 min read AngularJS number Filter 1 min read AngularJS orderBy Filter 4 min read AngularJs uppercase Filter 1 min read AngularJS Converting FunctionsAngularJS angular.lowercase() Function 2 min read AngularJS angular.uppercase() Function 1 min read AngularJS angular.forEach() Function 1 min read AngularJS Comparing FunctionsAngularJS angular.isArray() Function 2 min read AngularJS angular.isDate() Function 2 min read AngularJS angular.isDefined() Function 2 min read AngularJS angular.isElement() Function 2 min read AngularJS angular.isFunction() Function 2 min read AngularJS angular.isNumber() Function 2 min read AngularJS angular.isObject() Function 2 min read AngularJS | angular.isString() Function 1 min read AngularJS angular.isUndefined() Function 2 min read AngularJS angular.equals() Function 2 min read AngularJS angular.toJson() Function 2 min read AngularJS QuestionsHow to bundle an Angular app for production? 4 min read How to add many functions in one ng-click directive? 2 min read How to directly update a field by using ng-click in AngularJS ? 3 min read How to Add Dynamic Options for Multiple Selects Inside ng-repeat Directive ? 3 min read How to detect when an @Input() value changes in Angular? 3 min read How to open popup using Angular and Bootstrap ? 2 min read How to reload or re-render the entire page using AngularJS? 2 min read How to add input fields dynamically on button click in AngularJS ? 2 min read How to Create Button Dynamically with Click Event in Angular ? 2 min read How to use jQuery in Angular ? 2 min read AngularJS Examples 2 min read Like