Skip to content

Instantly share code, notes, and snippets.

@letsjustfixit
Created January 27, 2017 10:51
Show Gist options
  • Save letsjustfixit/29ab1801e57723fa58e39128e8871cda to your computer and use it in GitHub Desktop.
Save letsjustfixit/29ab1801e57723fa58e39128e8871cda to your computer and use it in GitHub Desktop.
import { Component } from '@angular/core';
import { NgForm } from '@angular/forms';
import { NavController } from 'ionic-angular';
import { SignupPage } from '../signup/signup';
import { TabsPage } from '../tabs/tabs';
import { UserData } from '../../providers/user-data';
@Component({
selector: 'page-user',
templateUrl: 'login.html'
})
export class LoginPage {
login: {username?: string, password?: string} = {};
submitted = false;
constructor(public navCtrl: NavController, public userData: UserData) { }
onLogin(form: NgForm) {
this.submitted = true;
if (form.valid) {
this.userData.login(this.login.username);
this.navCtrl.push(TabsPage);
}
}
onSignup() {
this.navCtrl.push(SignupPage);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment