angularjs-de/angular2-tutorial

Either the name attribute must be set or the form control must be defined as 'standalone'

ilosuna opened this issue · 4 comments

In angular2-tutorial/03b-two-way-data-binding/src/app/app.component.ts:

EXCEPTION: Error in ./AppComponent class AppComponent - inline template:5:11 caused by: If ngModel is used within a form tag, either the name attribute must be set or the form
control must be defined as 'standalone' in ngModelOptions.

Fix:
<input type="text" name="search" [(ngModel)]="search" >

will check that, thanks and nice avatar 👍

It is working without any problem?

Because we are not using a form around the input!

If you added this on your own --> sure you have to correctly create a template- or model-driven form!

Please close this issue, if you added the form-tags in your example

Sorry, the snippet with the form tags came from the tutorial (chapter "Zwei-Wege-Datenbindung"). The code in the repository without form tags works without name attribute.

Thanks anyways --> i changed the tutorial :)