Anas Bennis Anas Bennis - 5 months ago 23
AngularJS Question

Dynamic ng-model name in AngularJS

I have a problem with inputs that are generated dynamically.
How can I get their values?

<p ng-repeat="(key, value) in selectedTemplate.attributes.Params.attributes">
{{key}} : <tr><input ng-model="params[key]" type="text" placeholder="{{value}}" >

//attributes are like this
"attributes": {
"End Date": "java.sql.Timestamp",
"Containers": "java.lang.Object",
"Begin Date": "java.sql.Timestamp"



Just declare $scope.params = {} in your controller. and after that you can access the values by : $scope.params['End Date'], $scope.params['Containers'], $scope.params['Begin Date']