Skip to content

Commit

Permalink
Step 14.3: Use getNumber native method
Browse files Browse the repository at this point in the history
  • Loading branch information
darkbasic committed Oct 16, 2017
1 parent ab72bf1 commit f2f2ec6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/pages/login/login.ts
@@ -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';
Expand All @@ -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(
Expand All @@ -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();
Expand Down

0 comments on commit f2f2ec6

Please sign in to comment.