ionic-team / ionic-starter-super

The Ionic 2 Super Starter 🎮
Other
376 stars 142 forks source link

Fixed variant of form with using Username #114

Closed mifkys closed 7 years ago

mifkys commented 7 years ago

Short description of what this resolves:

Fixed variant of form with using Username instead of Email. Example not work without name="username"

Changes proposed in this pull request:

janpio commented 7 years ago

What exactly is not working without this change?

mifkys commented 7 years ago

Error when uncomment block with username input:

<ion-list>

      <ion-item>
        <ion-label fixed>{{ 'USERNAME' | translate }}</ion-label>
        <ion-input type="text" [(ngModel)]="account.username"></ion-input>
      </ion-item>

      <ion-item>
        <ion-label fixed>{{ 'PASSWORD' | translate }}</ion-label>
        <ion-input type="password" [(ngModel)]="account.password" name="password"></ion-input>
      </ion-item>

      <div padding>
        <button ion-button color="primary" block>{{ 'LOGIN_BUTTON' | translate }}</button>
      </div>

    </ion-list>

Error: Uncaught (in promise): Error: 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.

  Example 1: <input [(ngModel)]="person.firstName" name="first">
  Example 2: <input [(ngModel)]="person.firstName" [ngModelOptions]="{standalone: true}">

Error: 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.

  Example 1: <input [(ngModel)]="person.firstName" name="first">
  Example 2: <input [(ngModel)]="person.firstName" [ngModelOptions]="{standalone: true}">

at TemplateDrivenErrors.missingNameException (http://localhost:8100/build/main.js:24105:9) at NgModel.prototype._checkName (http://localhost:8100/build/main.js:24423:13) at NgModel.prototype._checkForErrors (http://localhost:8100/build/main.js:24402:9) at NgModel.prototype.ngOnChanges (http://localhost:8100/build/main.js:24307:9) at checkAndUpdateDirectiveInline (http://localhost:8100/build/main.js:11142:9) at checkAndUpdateNodeInline (http://localhost:8100/build/main.js:12567:13) at checkAndUpdateNode (http://localhost:8100/build/main.js:12507:9) at debugCheckAndUpdateNode (http://localhost:8100/build/main.js:13210:5) at debugCheckDirectivesFn (http://localhost:8100/build/main.js:13151:13) at Anonymous function (Function code:693:5) at c (http://localhost:8100/build/polyfills.js:3:13184) at Anonymous function (http://localhost:8100/build/polyfills.js:3:12546) at NavControllerBase.prototype._fireError (http://localhost:8100/build/main.js:46638:13) at NavControllerBase.prototype._failed (http://localhost:8100/build/main.js:46626:9) at Anonymous function (http://localhost:8100/build/main.js:46681:46) at t.prototype.invoke (http://localhost:8100/build/polyfills.js:3:8874) at onInvoke (http://localhost:8100/build/main.js:4480:21) at t.prototype.invoke (http://localhost:8100/build/polyfills.js:3:8874) at r.prototype.run (http://localhost:8100/build/polyfills.js:3:4114) at Anonymous function (http://localhost:8100/build/polyfills.js:3:13722)