I am trying to make my ng-model dynamic, when i use only one level object ng-model="data[question.option_group_id]" it works fine. However when try to use 2 level object structure ng-model="data[page.id][question.option_group_id]" it gives me error: TypeError: Cannot set property '10' of undefined.
<div class="radio" ng-repeat="option in question.option_group.option_choices">
<label>
<input type="radio" ng-model="data[page.id][question.option_group_id]" value="{{ option.id }}" name="{{ question.option_group_id }}">
{{ option.name }}
</label>
</div>
Any ideas how can this be solved ?