Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set "data-value" Attribute of div in angular 2 [duplicate]

<div data-value="{{tagName}}">{{tagName}}</div>

Getting "data-value is not a valid attribute" of div error.

like image 1000
sathishkumar Avatar asked Feb 19 '16 15:02

sathishkumar


1 Answers

By default Angular2 binds to properties for performance reasons. To explicitly bind to attributes use one of these options

attr.data-value="{{tagName}}"

or

[attr.data-value]="tagName"
like image 99
Günter Zöchbauer Avatar answered Nov 14 '22 22:11

Günter Zöchbauer