title: Angular2 If ngModel is used within a form tag, either the name attribute must be set or the form
body: <p>I am getting this error from Angular 2</p>
  <blockquote>
  <p>core.umd.js:5995 EXCEPTION: Uncaught (in promise): Error: Error in app/model_exposure_currencies/model_exposure_currencies.component.html:57:18
  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.</p>
  </blockquote>
  <p>Example 1:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;input [(ngModel)]=&quot;person.firstName&quot; name=&quot;first&quot;&gt;
  </code></pre>
  <p>Example 2:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;input [(ngModel)]=&quot;person.firstName&quot; [ngModelOptions]=&quot;{standalone: true}&quot;&gt; 
  </code></pre>
  <pre class="lang-html prettyprint-override"><code>&lt;td *ngFor=&quot;let lag of ce.lags&quot;&gt;
      &lt;div class=&quot;form-group1&quot;&gt;
          &lt;input name=&quot;name&quot; [(ngModel)]=&quot;lag.name&quot; [ngModelOptions]=&quot;{standalone: true}&quot;  class=&quot;form-control&quot; pattern=&quot;[0-9]*(\.[0-9]+)?&quot; required&gt;
      &lt;/div&gt;
  &lt;/td&gt;
  </code></pre>
  <p>This is how I use form tag:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;form #f=&quot;ngForm&quot; (ngSubmit)=&quot;onSubmit()&quot;&gt;
  </code></pre>