chungtinhlakho chungtinhlakho - 3 months ago 28
Javascript Question

angular2 getting value of custom attribute

I have input elements with a custom attribute call field.

<input type="text" (change)="recordChange(currentField,row)" #currentField field="caution">

On the change event, the currentField came back like this one the console.

<input type="hidden" field="caution" value="plus icon red">

I was able to do currentField.value to obtain the value, but I can't seems to figure out how to get the field value. What am I missing?

thanks for your time.


There is the getAttribute(...) method for that on elements:


See also getAttribute() versus Element object properties?