nlr_p nlr_p - 1 month ago 21
TypeScript Question

How to use onchange in angular2

I have a which is editable.I want to send the edited new data to function and how can i get the data in the tag,can anyone help me.

<td (blur) ='showsavephonemodel(i want the newly edited value here i.e student.phone)' contenteditable="true" class ='phone' >
{{student.phone}}
</td>

Answer

You should use (keyup) or (blur) event instead,

<td (keyup)='showsavephonemodel()' class ='phone'>
     {{student.phone}}  
</td>


<td (blur)='showsavephonemodel()' class ='phone'>
     {{student.phone}}  
</td>