I am trying to trigger an event when textarea focus is out. I have tried to use (blur) also. When I use (focusout) the method was trigger. But [(ngModel)] value saved as [object FocusEvent]
This is my component.html
div class="form-input">
<textarea class="form-textarea" rows="2" [(ngModel)]="measurementPoint.Comment" (focusout)="updateMeasurementPointComment($event, component.Id, measurementPoint.CompartMeasurementPointId)">
</textarea>
</div>
This is my component.ts
updateMeasurementPointComment(comment: string, inspectionDetailId: number, compartMeasurementPointId: number) {
this._service.updateMeasurementPointComment(inspectionDetailId, compartMeasurementPointId,comment ).subscribe(r => {
if (r.m_Item1) {
console.log(comment);
this._notify.success('Saved', r.m_Item2);
} else {
this._notify.alert('Couldn\'t Save', r.m_Item2);
console.log(r.m_Item2);
}
}, err => {
console.log(err);
this._notify.alert('Error', 'Unable to update the measurement comment. Please contact support for help. ');
});
}
This is Out Put---------
JUST NEED TO CHANGE THE METHOD HERE.... REPLACE THE $EVENT WITH [(ngModel)] value. Now it is perfectly work. Thank you everyone. :)
div class="form-input">
<textarea class="form-textarea" rows="2" [(ngModel)]="measurementPoint.Comment" (focusout)="updateMeasurementPointComment(measurementPoint.Comment, component.Id, measurementPoint.CompartMeasurementPointId)">
</textarea>
</div>