Operator '>' cannot be Applied to types 'Boolean' and 'number'. ng build --Prod

Asked

Viewed 161 times

0

I wonder what might be going on in this case. Every time I try to run the command ng build --prod this error appears saying that it is in the HTML file of one of the components on line 76, follows below such line of error. Even removing it for testing does not work. Something else also when I run the command ng build works.

<app-campo-control-erro [mostrarErro]="verificaValidTouchedEpi('quantidade')" mensagemErro="Informe a quantidade."></app-campo-control-erro>

Follows excerpt from the method verificaValidTouchedEpi

verificaValidTouchedEpi(campo: string) {
  return (
    !this.formularioEpi.get(campo).valid &&
    (this.formularioEpi.get(campo).dirty || this.formularioEpi.get(campo).touched)
  );
}

This method is used in other fields of my form but the error is only in that line.

  • Shows the code of the relevant component as well, will help analyze

  • Anderson, could you show the code inside the method verificaValidTouchedEpi ?

  • You cannot compare if a Boolean (bool) is larger than the other it only returns true and false values

  • Anderson, I’ve seen your method, but I can’t identify the problem. see, the problem is something like the one Marcos Brinner commented above, somewhere you are comparing one Boolean to another, or with some number, for example: if(false > 2) Do you agree that this makes no sense? Or if(false > true) try to identify something like this in your code. I thought you were in this method verificaValidToucheEpi but apparently you’re not.

  • Richard Willian really agrees that it doesn’t make sense, but I’ve checked my entire component carefully and there’s nothing like it. The only parolees.

  • The problem I think is that the form or some property of yours is private and html is not finding. gives a look at this link of possible code problems in production https://github.com/rangle/angular-2-aot-sandbox

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.