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

Conversation

@blai
Copy link

@blai blai commented Sep 20, 2013

Not exactly sure if this is a bug fix or a feature enhancement. For simple cases such as the following, it works:

<form name="myForm">
    User name: <input type="text" name="userName" ng-model="user.name" required>
    <span class="error" ng-show="myForm.userName.$error.required">Required!</span>
</form>

But if the <input> is dynamically generated and the name is a scope property, it run into issue:

<form name="myForm">
    <div ng-repeat="field in formFields">
        <span>{{field.label}}</span>
        <input type="text" name="{{field.name}}" required>
        <span class="error" ng-show="myForm[field.name].$error.required">Required!</span>
    </div>
</form>

@mary-poppins
Copy link

Thanks for the PR!

  • Contributor signed CLA now or in the past
    • If you just signed, leave a comment here with your real name
  • PR's commit messages follow the commit message format

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@blai
Copy link
Author

blai commented Sep 20, 2013

Forgot if I have submitted CLA before, just did a click through once more with my name Brian Lai.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be done through $attrs.$observe and it needs to update the forms each time attribute changes.

@petebacondarwin
Copy link
Contributor

Duplicate of #3135?

@Narretz
Copy link
Contributor

Narretz commented Oct 13, 2014

Implemented differently in 729c238

@Narretz Narretz closed this Oct 13, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants