import { Component, OnInit, Output, EventEmitter, ViewChild } from '@angular/core'; import { NgForm } from '@angular/forms'; @Component({ selector: 'ucap-chat-form', templateUrl: './form.component.html', styleUrls: ['./form.component.scss'] }) export class FormComponent implements OnInit { @Output() send = new EventEmitter(); @ViewChild('replyForm', { static: false }) replyForm: NgForm; constructor() {} ngOnInit() {} onSend(event: Event) { event.preventDefault(); this.send.emit(this.replyForm.form.value.message); this.replyForm.reset(); } }