how can I have the return of the variable "this.qdDias" assigned a value to it. I don't know why when I use subscribe I can't get the value at the end of the method. In this "console.log(this.qdDias) " I see the value, but it lowers in the return, the variable becomes undefined again.
> obterParametroPrazoMap(nomePrazo: string): number {
>         console.log("Parametro vindo: ", nomePrazo)
>         this.service.obterParametrosgeraisMap().subscribe((data) => {
>             this.listParametrosGerais = data.data;
>             this.listParametrosGerais.forEach((x) =>  (this.listParametrosGerais, x));
>             for (var i = 0; i < this.listParametrosGerais.length; i++) {
>                 console.log("comparado: ", this.listParametrosGerais[i].chavePrimaria.tipoParametro.nomeTipoParametro)
>                 if (this.listParametrosGerais[i].chavePrimaria.tipoParametro.nomeTipoParametro
> === nomePrazo) 
>                 {   
>                     this.qdDias = this.listParametrosGerais[i].quantidadeDiasPrazo;
>                     console.log(this.qdDias)                    
>                     break
>                 }
>             }
>         }                   
>         );
>        return this.qdDias;
>     }
How to solve this?
 
    