Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't bind to 'value' since it isn't a known native property [duplicate]

Tags:

angular

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 ???

like image 928
SK7 Avatar asked Nov 24 '25 10:11

SK7


1 Answers

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>
like image 50
Günter Zöchbauer Avatar answered Nov 26 '25 01:11

Günter Zöchbauer