Skip to content

Error on building app with --prod -aot #5765

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

Closed
rex79 opened this issue Mar 30, 2017 · 4 comments
Closed

Error on building app with --prod -aot #5765

rex79 opened this issue Mar 30, 2017 · 4 comments

Comments

@rex79
Copy link

rex79 commented Mar 30, 2017

Hi all, I've got this error when I try to build my app with --prod -aot, with ng serve everythings works fine.

ERROR in /media/1tb/Sites/solution-timing/solution-timing-admin/src/$$_gendir/app/users/user-editing/user-editing.component.ngfactory.ts (645,55): Property 'email' does not exist on type '{}'.

The ts file is like this:

export class UserEditingComponent implements OnInit {
  snackBar:MdSnackBar;
  usersService:UsersServices
  edit_form: {};
  current_user;
  commonServices:CommonServices;

  constructor(
    private dialogRef: MdDialogRef<UserEditingComponent>,
    private _snack:MdSnackBar,
    private _cond:UsersServices,
    private _comm:CommonServices,
  ) {
    this.edit_form = {};
    this.usersService = _cond;
    this.commonServices = _comm;
    this.snackBar = _snack;
    this.usersService = _cond;
    this.current_user = {};
    this.resetErrorMsg();
  }

creaNuovoUtente() {
    if (this.current_user.password !== this.current_user.password_confirm) {
      this.commonServices.printAlertMsg('Errore! Le due password non coincidono', 6000);
      return false
    }
    this.current_user.crypted_password = this.current_user.password;
    delete this.current_user.password;
    delete this.current_user.password_confirm;
    this.usersService.createNewUser(this.current_user).subscribe((result) => {
      if (result.err === 100) {
        this.commonServices.printAlertMsg('Errore salvataggio utente', 3000);
        return false;
      }
      this.dialogRef.close('Utente creato con successo');
    },
    (error) => {
      this.commonServices.printAlertMsg('Errore salvataggio nuovo utente', 3000);
    });
  }

I don't know why it gives me this error when with ng serve command is all fine and I can run and use my app.
This is the info about my app:

-> % ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ | | __ _ _ __ / | | | |
/ △ \ | '
\ / _ | | | | |/ _ | '
| | | | | | |
/ ___ | | | | (
| | || | | (| | | | || | | |
// __| ||_, |_,||_,|| _|||
|___/
@angular/cli: 1.0.0
node: 7.2.0
os: linux x64
@angular/common: 2.4.10
@angular/compiler: 2.4.10
@angular/core: 2.4.10
@angular/flex-layout: 2.0.0-beta.4
@angular/forms: 2.4.10
@angular/http: 2.4.10
@angular/material: 2.0.0-beta.2
@angular/platform-browser: 2.4.10
@angular/platform-browser-dynamic: 2.4.10
@angular/router: 3.4.10
@angular/cli: 1.0.0
@angular/compiler-cli: 2.4.10

@will421
Copy link

will421 commented Mar 30, 2017

I suppose
edit_form: {};
is not correct because {} is not a type with "mail"

Are you sure it is cli related ?

@rex79
Copy link
Author

rex79 commented Mar 30, 2017

Yes, it was that line! Thanks a lot.

I was confused because on development mode it works and on the error it talks about email and password which are fields of current_user and non edit_form.

Why angular 2 messages are so cryptic?

@filipesilva
Copy link
Contributor

filipesilva commented May 3, 2017

Closing as answered by @will421, cheers!

@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 7, 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

3 participants