Login/php/


#1

Hi guys I need help you, I want to create a login simple only with one input email

msgError: string;
loader: any;
clientes: any[];

constructor(public service: ServiceProvider ,public navCtrl: NavController, public loadCtrl: LoadingController) {}

login(email: string){
this.service.getData(‘Login’).subscribe(
data => this.clientes = data,
err => this.msgError = err
);
this.presentLoading();
}

presentLoading(){
this.loader = this.loadCtrl.create({
content: ‘Carregando…’,
duration: 2000
});
this.loader.present();
this.navCtrl.push(ListaDistribuidoresPage);
this.loader.dismiss();
}

I would like a condition like this
if (emaill === data.email){
this.presentLoading();
}else{
console.log(‘email not found’)
}


#2

I’m not sure what you’re asking, but I can tell you this: the only place you can access the data that is coming from the service is inside the subscribe block. Any attempt to reference it elsewhere will result in race conditions where things sometimes do what you expect and sometimes don’t.


#3

I have um input and button
button ion-button block (click)=“login(email.value)” [disabled]=“email.invalid”>Entrar
<button ion-button block color=“secondary” [navPush]=“novoUsuario”>Novo Usuário</button

I want make login with email only