Child.component.ts

export class ChildComponent{

  @Input() parentInput: string = '';

  message: string = '';

  private messageSubject = new Subject<string>();

  message$ = this.messageSubject.asObservable().pipe(
    debounceTime(300), // Optional: Debounce to emit only after 300ms of no changes
    distinctUntilChanged() // Optional: Only emit if the value actually changes
  );

  constructor() {}

  sendMessage() {
    this.messageSubject.next(this.message);
  }
}