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

Pick the right attribute value for form.$name if ng-form directive is used as an attribute #2997

Closed
wants to merge 1 commit into from

Conversation

lastnico
Copy link

Pick the right attribute value for form.$name if ng-form directive is used as an attribute.

This is especially important when you want your inner form to be published as a control of its parent form.

Currently, if you have this code snippet:

<form name="mainForm">
  <div ng-form="subForm">
    ...
  </div>
</form>

-> mainForm.subForm will not be available


<form name="mainForm">
  <div ng-form="whateverValue" name="subForm">
    ...
  </div>
</form>

-> while it will work in this case.

… used as an attribute

This is especially important when you want your inner form to be published as a control of its parent form. 

Currently, if you have this code snippet:

<form name="mainForm">
  <div ng-form="subForm">
    ...
  </div>
</form>

-> mainForm.subForm will not be available

-----------------

<form name="mainForm">
  <div ng-form="whateverValue" name="subForm">
    ...
  </div>
</form>

-> while it will work in this case.
@petebacondarwin
Copy link
Member

Here is a plunker demonstrating this: http://plnkr.co/edit/F4aZHfD0yE8kQsMfpvkx?p=preview

@petebacondarwin
Copy link
Member

PR Checklist (Minor Bugfix)

  • Contributor signed CLA now or in the past (if you just signed, leave a comment here with your real name)
  • PR doesn't introduce new api
  • PR doesn't contain a breaking change
  • PR contains unit tests
  • PR contains e2e tests (if suitable)
  • PR contains documentation update (if suitable)
  • PR passes all tests on Travis (sanity)
  • PR passes all tests on ci.angularjs.org (cross-browser compatibility)
  • PR is rebased against recent master
  • PR is squashed into one commit per logical change
  • PR's commit messages are descriptive and allows us to autogenerate release notes (required commit message format)
  • All changes requested in review have been implemented

@lastnico
Copy link
Author

CLA signed (Nicolas Ternisien is my real name).

@petebacondarwin
Copy link
Member

We need a unit test for this.

@pkozlowski-opensource
Copy link
Member

In case if @lastnico is not coming back to us here is the re-written version with a test:
pkozlowski-opensource@2f9fe72

@lastnico
Copy link
Author

Hi,

Sure, Pawel's version looks similar and is well tested (compared to mine),
so please use his.

Best,

Nicolas Ternisien

2013/7/20 Pawel Kozlowski notifications@github.com

In case if @lastnico https://github.com/lastnico is not coming back to
us here is the re-written version with a test:
pkozlowski-opensource/angular.js@2f9fe72pkozlowski-opensource@2f9fe72


Reply to this email directly or view it on GitHubhttps://github.com//pull/2997#issuecomment-21297164
.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants