Permalink
Browse files

Step 14.3: Use getNumber native method

  • Loading branch information...
darkbasic committed Jun 2, 2017
1 parent ab72bf1 commit f2f2ec67ce10e1653bd4c3448f8518485e7c4a1d
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/pages/login/login.ts
View
@@ -1,4 +1,4 @@
import { Component } from '@angular/core';
import { Component, AfterContentInit } from '@angular/core';
import { Alert, AlertController, NavController } from 'ionic-angular';
import { PhoneService } from '../../services/phone';
import { VerificationPage } from '../verification/verification';
@@ -7,7 +7,7 @@ import { VerificationPage } from '../verification/verification';
selector: 'login',
templateUrl: 'login.html'
})
export class LoginPage {
export class LoginPage implements AfterContentInit {
private phone = '';
constructor(
@@ -16,6 +16,12 @@ export class LoginPage {
private navCtrl: NavController
) {}
ngAfterContentInit() {
this.phoneService.getNumber()
.then((phone) => this.phone = phone)
.catch((e) => console.error(e.message));
}
onInputKeypress({keyCode}: KeyboardEvent): void {
if (keyCode === 13) {
this.login();

0 comments on commit f2f2ec6

Please sign in to comment.