Parent share to child
parentMsg:string = "This is a parent message.";
<app-child [childMsg]="parentMsg"></app-child>
import { import Input } from '@angular/core';
@Input() childMsg: string;
Child share to parent
import { Output, EventEmitter } from '@angular/core';
@Output defineYourEvent = new EventEmiter<string>();
sendFromChildMsg:string = "This message send form child.";
this.defineYourEvent.emit(sendFromChildMsg);
parentMsg:string = "default message.";
updateParentMsg(receiveMsg:string):void{
this.parentMsg = receiveMsg;
}
<app-child (defineYourEvent)="updateParentMsg($event)"></app-child>