Permalink
Browse files

Step 14.8: Use getSMS method in verification.ts

  • Loading branch information...
darkbasic committed Jun 3, 2017
1 parent c085609 commit 1f9cca1750a6ea0b5ca5840e5514d0ea5d57ac48
Showing with 15 additions and 2 deletions.
  1. +15 −2 src/pages/verification/verification.ts
@@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { AfterContentInit, Component, OnInit } from '@angular/core';
import { AlertController, NavController, NavParams } from 'ionic-angular';
import { PhoneService } from '../../services/phone';
import { ProfilePage } from '../profile/profile';
@@ -7,7 +7,7 @@ import { ProfilePage } from '../profile/profile';
selector: 'verification',
templateUrl: 'verification.html'
})
export class VerificationPage implements OnInit {
export class VerificationPage implements OnInit, AfterContentInit {
private code: string = '';
private phone: string;
@@ -22,6 +22,19 @@ export class VerificationPage implements OnInit {
this.phone = this.navParams.get('phone');
}
ngAfterContentInit() {
this.phoneService.getSMS()
.then((code: string) => {
this.code = code;
this.verify();
})
.catch((e: Error) => {
if (e) {
console.error(e.message);
}
});
}
onInputKeypress({keyCode}: KeyboardEvent): void {
if (keyCode === 13) {
this.verify();

0 comments on commit 1f9cca1

Please sign in to comment.