Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

ng-form directive can't have a dynamic name #7269

Closed
@a-lucas

Description

@a-lucas

Hello,

I have been using anglarjs quite a lot recently, and I have been working on a validation provider.
I need to get my validation logic to override angularjs's default validation.

For example, if a subform is pristine, then the form is invalid. I needed it the other way.

And another situation where the form is not pristine, but all fields are empty -> the parent form is valid...

After endless hours of development, my custom provider finally handles all this very well, and I finally get typahead + custom datepicker works well, with all my validations.

I am now in the situation where i need to add dynamically some ng-form, and access them by name or by object.

For example :

  <form name="MainForm">
   <div ng-form name="myForm">
    //inputs
   <button type=button ng-click="myValidator.submit(myForm)"
  </div>
 </form>

Where myForm represent the form with all the $pristine/$valid... properties that I can manipulate trough myValidator provider.

Now, If I get a dynamic name :

<form name="MainForm">
 <div ng-form name="{{dynname}}">
  //inputs
  <button type=button ng-click="myValidator.submit( dynname ) "
 </div>
</form>

There is no ways I can access this ng-form from my controller.

 typeof  $scope.MainForm[$scope.dynname] === 'undefined'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions