I have a structure like this
$scope.mydata = {
'attribute': 'value',
'otheratribute' : 'othervalue',
'thirdatribute' : {
'name': 'xx',
'desc': 'yy'
}
}
and input to the thirdatribute like this
<form name="myForm">
<div ng-class="{ 'has-error': myForm.thirdatribute.name.$invalid }">
<span>My subdata</span>
<input name="thirdatribute['name']" type="text"
ng-model="mydata.thirdatribute.name" required>
</div>
</form>
the root atributes attribute and otheratribute validation work fine but the thirdatribute throw an error on console:
TypeError: Cannot read property '$invalid' of undefined
some idea that i can do?