chungtinhlakho chungtinhlakho - 1 year ago 173
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.

Answer Source

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


See also getAttribute() versus Element object properties?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download