Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name attribute must be set if ngModel is used within a form #9287

Closed
mmrath opened this issue Jun 17, 2016 · 2 comments
Closed

Name attribute must be set if ngModel is used within a form #9287

mmrath opened this issue Jun 17, 2016 · 2 comments

Comments

@mmrath
Copy link

mmrath commented Jun 17, 2016

I'm submitting a ... (check one with "x")

[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

[(ngModel)] without name is not allowed in a form. This used to work in the previous(now deprecated) forms. I think a mix for template and model driven form in the same template should be allowed. I see the following error when ngModel is used in a form without a associated control.

Name attribute must be set if ngModel is used within a form.
Example: <input [(ngModel)]="person.firstName" name="first">

Expected/desired behavior

[(ngModel)] should be allowed in a form without an associated control

Reproduction of the problem

You can see the error in the dev console of this plunker
https://plnkr.co/edit/CcXGHjI6jkkW8YpR28ZI?p=preview

What is the expected behavior?
[(ngModel)] should be allowed in a form without an associated control.

What is the motivation / use case for changing the behavior?
Allow mix of template and model driven form. This is specially useful in case part of the form in not really part of the actual business model.

Please tell us about your environment:
RC2 with new forms

  • Angular version: 2.0.0-rc.2
  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
  • Language: [all | TypeScript X.X | ES6/7 | ES5 | Dart]
@mmrath
Copy link
Author

mmrath commented Jun 17, 2016

Looks like this a duplicate of #9230. I am closing this issue in favour of #9230

@mmrath mmrath closed this as completed Jun 17, 2016
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant