Skip to content

Instantly share code, notes, and snippets.

@geykel

geykel/login2.ts Secret

Created March 13, 2017 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geykel/f1052547b0434669c04b8c1a6ff67367 to your computer and use it in GitHub Desktop.
Save geykel/f1052547b0434669c04b8c1a6ff67367 to your computer and use it in GitHub Desktop.
import { Component } from '@angular/core';
import { NavController, AlertController } from 'ionic-angular';
import { TabsPage } from '../tabs/tabs';
import { Auth } from '../../providers/auth';
@Component({
selector: 'page-login',
templateUrl: 'login.html'
})
export class LoginPage {
credenciales = { usuario: '', contrasena: '' };
constructor(public navCtrl: NavController, public alertCtrl: AlertController, public auth: Auth) { }
iniciarSesion() {
if (this.auth.iniciarSesion(this.credenciales)) {
this.navCtrl.setRoot(TabsPage);
} else {
let alert = this.alertCtrl.create({
title: 'Error',
subTitle: 'Usuario y/o contraseña incorrecta.',
buttons: ['Cerrar']
});
alert.present(prompt);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment