Skip to content

Commit f2f2ec6

Browse files
committed
Step 14.3: Use getNumber native method
1 parent ab72bf1 commit f2f2ec6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/pages/login/login.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component } from '@angular/core';
1+
import { Component, AfterContentInit } from '@angular/core';
22
import { Alert, AlertController, NavController } from 'ionic-angular';
33
import { PhoneService } from '../../services/phone';
44
import { VerificationPage } from '../verification/verification';
@@ -7,7 +7,7 @@ import { VerificationPage } from '../verification/verification';
77
selector: 'login',
88
templateUrl: 'login.html'
99
})
10-
export class LoginPage {
10+
export class LoginPage implements AfterContentInit {
1111
private phone = '';
1212

1313
constructor(
@@ -16,6 +16,12 @@ export class LoginPage {
1616
private navCtrl: NavController
1717
) {}
1818

19+
ngAfterContentInit() {
20+
this.phoneService.getNumber()
21+
.then((phone) => this.phone = phone)
22+
.catch((e) => console.error(e.message));
23+
}
24+
1925
onInputKeypress({keyCode}: KeyboardEvent): void {
2026
if (keyCode === 13) {
2127
this.login();

0 commit comments

Comments
 (0)