Skip to content

Commit c2b0436

Browse files
committed
Step 17.6: Create a test login method and bind it to the user interface
1 parent e6fa60b commit c2b0436

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/pages/login/login.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,10 @@
2222
<ion-item>
2323
<ion-input [(ngModel)]="phone" (keypress)="onInputKeypress($event)" type="tel" placeholder="Your phone number"></ion-input>
2424
</ion-item>
25+
26+
<ion-item>
27+
<ion-buttons>
28+
<button ion-button (click)="loginFacebook()">Login with Facebook</button>
29+
</ion-buttons>
30+
</ion-item>
2531
</ion-content>

src/pages/login/login.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,21 @@ export class LoginPage implements AfterContentInit {
5050
alert.present();
5151
}
5252

53+
loginFacebook(): void {
54+
const options = {
55+
requestPermissions: ['public_profile', 'user_friends', 'email']
56+
};
57+
58+
(<any>Meteor).loginWithFacebook(options, (error: Error) => {
59+
if (error) {
60+
this.handleError(error);
61+
} else {
62+
console.log("Logged in with Facebook succesfully.");
63+
console.log(Meteor.user());
64+
}
65+
});
66+
}
67+
5368
handleLogin(alert: Alert): void {
5469
alert.dismiss().then(() => {
5570
return this.phoneService.verify(this.phone);

0 commit comments

Comments
 (0)