next-ucap-messenger/projects/ucap-webmessenger-ui-chat/src/lib/components/form.component.ts

33 lines
605 B
TypeScript
Raw Normal View History

2019-10-08 05:34:37 +00:00
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 {
2019-10-08 05:34:37 +00:00
@Output()
send = new EventEmitter<string>();
@ViewChild('replyForm', { static: false })
replyForm: NgForm;
constructor() {}
ngOnInit() {}
2019-10-08 05:34:37 +00:00
onSend(event: Event) {
event.preventDefault();
this.send.emit(this.replyForm.form.value.message);
this.replyForm.reset();
}
}