Lars Mertens Lars Mertens - 1 year ago 153
AngularJS Question

Concatenation possible in ng-model?

Just a simple question is it possible to concatenate a string called "id" inside the ng-model to variable in angularjs? Is there a way a approach like this could actually work?

This works:


This doesn't work:

ng-model='currentQuantity[id + "" +]'

Answer Source

You need to quote the string id or it will be evaluated as a scope variable


ng-model='currentQuantity[id + "" +]'


ng-model='currentQuantity["id" +]'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download