angularjs - How do I access form from ng-form if the form name is a variable? -


the following code works if formname set "myformname"

<ng-form="{{formname}}">    form dirty? : {{myformname.$dirty}}    entire form object : {{myformname | json}} </ng-form> 

but of course don't know form name because we're using variable.

how access form ng-form using variable form name , not using hardcoded form name?

the following doesn't work:

<ng-form="{{formname}}">    form dirty? : {{myscope[myscope.formname].$dirty}}    entire form object : {{myscope[myscope.formname] | json}} </ng-form> 

in angularjs templates, current $scope may referenced this. in mind, can use like

{{this[formname].$dirty}}