0

i'm using angular 2 material design and i want bind data to the mdl-badge but I get an error when i doing this way.

html code

 <div class="material-icons mdl-badge mdl-badge--overlap" data-badge={{numFlags}}>num Of flags</div>

ts component

   this.numFlags=msg++;
Manspof
  • 598
  • 26
  • 81
  • 173

1 Answers1

4

That syntax is not valid. You have to use

[attr.data-badge]="numFlags"

or

attr.data-badge={{numFlags}}

in order to bind numFlags to data-badge.

plnkr

QoP
  • 27,388
  • 16
  • 74
  • 74