javascript - How to add json value inside ng-model in angular -
<div data-ng-repeat="credentialsdata in credentialsdatas"> <div data-inline-validate data-error="{{ credentialsdata.key }}"> <label>{{ credentialsdata.key }}<i class="text-error">*</i></label> <input type="text" data-ng-model="datasource.{{ credentialsdata.key }}" placeholder="{{ credentialsdata.key }}" /> </div> </div>
but here throwing error
data-ng-model="datasource.{{ credentialsdata.key }}"
you don't need use binding in case, try javascript bracket notation syntax:
data-ng-model="datasource[credentialsdata.key]"
Comments
Post a Comment