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

Error: No value accessor for 'email' beta10 and @angular/form 0.2.0 rc3 #7461

Closed
tripathi-swapnil opened this issue Jul 29, 2016 · 6 comments

Comments

@tripathi-swapnil
Copy link

tripathi-swapnil commented Jul 29, 2016

import { Component } from '@angular/core';
import {  REACTIVE_FORM_DIRECTIVES, FormGroup, FormBuilder, Validators } from '@angular/forms';
import { NavController } from 'ionic-angular';
import {FeedPage} from '../feed/feed';

/*
  Generated class for the LoginPage page.

  See http://ionicframework.com/docs/v2/components/#navigation for more info on
  Ionic pages and navigation.
*/
@Component({
  templateUrl: 'build/pages/login/login.html',
  directives: [REACTIVE_FORM_DIRECTIVES],
  providers: [FormBuilder]
})
export class LoginPage {
  loginForm: FormGroup;

  constructor(private nav: NavController, private form_builder: FormBuilder) {
    this.loginForm = this.form_builder.group({
      email: [''], //, emailValidator.mailFormat
      password: ['']
    });
  }

  doLogin(event):void {
    console.log(this.loginForm.value);
  //  if (loginSuccessful) {
      this.nav.setRoot(FeedPage);
  //  }
  event.preventDefault();
 }

}

view

<!--
  Generated template for the LoginPage page.

  See http://ionicframework.com/docs/v2/components/#navigation for more info on
  Ionic pages and navigation.
-->
<ion-header>

  <ion-navbar>
    <ion-title>login</ion-title>
  </ion-navbar>

</ion-header>


<ion-content padding>

  <form [formGroup]="loginForm" (submit)="doLogin($event)">
    <ion-list class="loginSection" style="  vertical-align: middle">
      <ion-item [class.error]="!loginForm.controls.email.valid && !loginForm.controls.email.pristine">
        <ion-input type="email" formControlName="email" name="email"></ion-input>
      </ion-item>

      <ion-item [class.error]="!loginForm.controls.password.valid && !loginForm.controls.password.pristine">
        <ion-input type="password" formControlName="password" name="password" placeholder="Password"></ion-input>
      </ion-item>
    </ion-list>

    <button class="login" primary block>Login</button>

  </form>

</ion-content>

@WHarris22
Copy link

I think your issue is related to this one.

@tripathi-swapnil
Copy link
Author

tripathi-swapnil commented Jul 29, 2016

@WHarris22 - Kind of. Is it resolved , as i have already seen and tried many things but failed to achieve solution ?

@WHarris22
Copy link

It is closed so yes it is resolved.

You will need to install the nightly version though so you have a version of the framework that contains this fix.

@jgw96
Copy link
Contributor

jgw96 commented Jul 29, 2016

Hello all! I will be closing this issue as a duplicate of #7125 . Thanks for using Ionic!

@jgw96 jgw96 closed this as completed Jul 29, 2016
@tripathi-swapnil
Copy link
Author

@WHarris22, @jgw96 - still not able to get solution :( let me know the steps :(

@tripathi-swapnil
Copy link
Author

now can use in rc11 which supports rc4

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 8, 2018
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

4 participants