How to concatenate string inside html document

How can I concatenate string in HTML Attribute. I am using angular controller and in the part where I write some array in HTML (Code is below), I want to give input tag name that is "kolicina" + {{idhrana}} witch is attribute of object jelo.

 <div class = "rezultat" ng-repeat="jelo in hrana | filter:pretrazi_namirnice">
     <div>  {{jelo.naziv}}  </div>
     <div>  {{jelo.energijaKCal}}</div>
     <div>  {{jelo.proteini}}</div>
     <div>  {{jelo.uglj_hidrati}}</div>
     <div>  {{jelo.masti}}</div>
     <div><input type=text nama="kolicina"+{{idhrana}}></div>
     <div><input  type="button"  ng-click = 'dodaj(jelo)' value="Dodaj"></div>
 </div>

Upvotes: 8

Views: 39581

Answers (2)

Himesh Suthar
Himesh Suthar

Reputation: 572

http://plnkr.co/edit/uJcDZkrGNqzSibpgkTc9?p=preview

<input type=text name="kolicina {{idhrana}}">

working plnkr for understanding. hope this will help you.

Upvotes: 2

Philipp Meissner
Philipp Meissner

Reputation: 5482

You can do it like so:

<input type=text name="kolicina{{idhrana}}"></div>

No need to explicitely concatenate it. Also, I think you had a typo with nama versus the name-attribute.

Upvotes: 12

Related Questions