I have a page with several elements (using ng-repeat), each of these elements contains a bunch of read-only data and a form.
I use the ng-form directive and calling them like this question / answer
However, when my difference is different from the fact that I do not put the ng-form in the repeating element, since it doesn’t “feel good” to have all the / div fields displayed inside this form.
Instead, my html looks like this:
<div ng-controller="MyController"> <div ng-repeat="inst in Repeats"> {{inst.name}} <div>Loads of "read only" content here, including charts/custom directives</div> <ng-form name=frm_{{$index}}> <input type="text" ng-model="inst.name" /> </ng-form> </div> <input type="button" value="View scope in console" ng-click="View()" />
The problem is that I cannot access the forms in the area in the controller. The answer to the question (linked above) shows that this naming convention works, and I have to see several objects in the $ area in the controller in order to gain access.
However, as shown in this plunk , click the "View Area in Console" button - it shows that the forms have not been added to the area.
Do I need to modify the html structure to have both ng-repeat and ng-form for the same element for this?
source share