angular2 getting value of custom attribute

chungtinhlakho

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.

Günter Zöchbauer

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

currentField.getAttribute('field')

See also getAttribute() versus Element object properties?

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Magento - getting category custom attribute value

From Dev

Getting select value then add to custom html attribute

From Dev

Angular2 raw html custom attribute

From Dev

Angular2 Bind Attribute Value

From Dev

custom directive attribute value is not getting in templateUrl callback function

From Dev

Getting angular directive attribute value returns 'undefined'

From Dev

Angular.js // Getting element by attribute value

From Dev

getting a attribute value in a directive in angular js

From Dev

Angular Custom directive change attribute value

From Dev

Custom Value Accessor in Angular2

From Dev

Custom Value Accessor in Angular2

From Dev

Getting pointer attribute value

From Dev

Getting specific attribute value

From Dev

Getting the data attribute value

From Dev

Get custom attribute value

From Dev

Custom Attribute on return value

From Dev

Get custom attribute value

From Dev

Attribute.GetCustomAttributes() not getting my custom attribute

From Dev

Getting key and value from JSON with angular2

From Dev

Getting key and value from JSON with angular2

From Dev

Getting Observable value before executing function in Angular2

From Dev

Getting a specific value from an angular2 *ngFor array

From Dev

angular2 getting string value out of Observable into local var

From Dev

getting an attribute value using jquery

From Dev

Getting data attribute value in td

From Dev

getting an attribute value using jquery

From Dev

XSL attribute value not getting displayed

From Dev

XSLT getting namespaced attribute value

From Dev

getting html attribute value with jquery