3

I am using angular2 beta 15 and in one of my templates I did that :

 <a  data-value="{{i18n.currentLanguage}}" > {{i18n.translate('Language')}}</a>

But, I get this exception

angular2.dev.js:23925 EXCEPTION: Error: Uncaught (in promise):Template parse errors:
Can't bind to 'value' since it isn't a known native property ("<div>
<a  [ERROR ->]data-value="{{i18n.currentLanguage}}">{{i18n.translate('Language')}}</a>

So, is there any idea how to solve that ???

SK7
  • 643
  • 1
  • 6
  • 15

1 Answers1

7

Use attribute binding instead of the default property binding

<a  attr.data-value="{{i18n.currentLanguage}}" > {{i18n.translate('Language')}}</a>

or

<a  [attr.data-value]="i18n.currentLanguage" > {{i18n.translate('Language')}}</a>
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567