angularjs - How to access from parent form to a certain child form generated in ng-repeat without the need to add things like frmChild {{$index}}? -
how access frmparent
frmchild
? (without need add things like: frmchild {{$index}}
).
<div ng-form="frmparent"> how know frmchild (i.e @ index 3) $pristine value here <div ng-form="frmchild" ng-repeat="item in mct.listofelements"> {{item.name}}: <input type="text" ng-model="item.value" /> pristine: {{frmchild.$pristine}} </div> </div>
here working example play i'm talking about.
you can use unique names child forms, ex. item.name
if it's supposed unique:
<div ng-repeat="item in mct.listofelements" ng-form="{{item.name}}"> {{item.name}}: <input type="text" ng-model="item.value" /> pristine: {{frmparent[item.name].$pristine}} </div>
and refer required child form it's name:
d pristine: {{frmparent.d.$pristine}}
please see plunker.
Comments
Post a Comment