0
<div class="pw-form-control-text" id="disclosureQuestionsPrepopulate" name="disclosureQuestionsPrepopulate"  ng-repeat="type in (prepopulatingFieldData|prepopulateValue:'c2a39346-9e95-e411-bd87-00155d005107')" >

<div >
<input name="{{type.Id}}" ng-model="formData.disclosureQuestionsPrepopulate"($index + 1) ng-click="option.selected = true" type="radio" value=true >Yes</input>

</input>

here what I want to do is my ng-model name should be like this

formData.disclosureQuestionsPrepopulate1", formData.disclosureQuestionsPrepopulate2

like that but it doesnt work. Can someone help me?

Pankaj Parkar
  • 134,766
  • 23
  • 234
  • 299
Lasal Sethiya
  • 201
  • 1
  • 4
  • 17
  • possible duplicate of [How to generates dynamically ng-model="my\_{{$index}}" with ng-repeat in AngularJS?](http://stackoverflow.com/questions/19573001/how-to-generates-dynamically-ng-model-my-index-with-ng-repeat-in-angularj) – squiroid Feb 23 '15 at 05:40

1 Answers1

1

It should use [] to assign create a array for ng-model variable & also Value attribute should be ng-value to ensure binding with check box

HTML

<input ng-attr-name="{{type.Id}}" 
ng-model="formData['disclosureQuestionsPrepopulate'+($index + 1)]" 
ng-click="option.selected = true" type="radio" ng-value="true"/>Yes
Pankaj Parkar
  • 134,766
  • 23
  • 234
  • 299