本文整理汇总了TypeScript中angularfire2.FirebaseAuth.subscribe方法的典型用法代码示例。如果您正苦于以下问题:TypeScript FirebaseAuth.subscribe方法的具体用法?TypeScript FirebaseAuth.subscribe怎么用?TypeScript FirebaseAuth.subscribe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angularfire2.FirebaseAuth
的用法示例。
在下文中一共展示了FirebaseAuth.subscribe方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(public auth$: FirebaseAuth) {
this.authState = auth$.getAuth();
auth$.subscribe((state: FirebaseAuthState) => {
this.authState = state;
});
}
示例2: constructor
constructor(private _af: AngularFire, private _auth: FirebaseAuth) {
this._auth.subscribe(authData => {
if (authData) {
this._mealPlans = _af.database.list(`/meal-plans/${authData.uid}`);
}
});
}
示例3: init
public init() {
// subscribe to the auth object to check for the login status
// of the user, if logged in, save some user information and
// execute the firebase query...
// .. otherwise
// show the login modal page
this.auth.subscribe((data) => {
console.log("in sam.auth.service subscribe ", JSON.stringify(data))
if (data) {
if (data.twitter) {
this.authInfo = data.twitter;
this.authInfo.displayName = data.twitter.displayName;
} else if (data.github) {
this.authInfo = data.github;
this.authInfo.displayName = data.github.displayName;
} else if (data.google) {
this.authInfo = data.google;
this.authInfo.displayName = data.google.displayName;
} else {
this.authInfo = data.password;
this.authInfo.displayName = data.password.email;
}
this.authInfo.uid = data.uid;
} else {
this.authInfo = null;
}
})
}
示例4: constructor
constructor( private auth$: FirebaseAuth) {
// / this.authState = auth$.getAuth();
auth$.subscribe((state: FirebaseAuthState) => {
this.authState = state;
console.log(this.authState);
});
}
示例5: constructor
constructor(private _af: AngularFire, private _auth: FirebaseAuth) {
this._activities = _af.database.list('/activities');
this._auth.subscribe(authData => {
if (authData) {
this._activityPlans = _af.database.list(`/activity-plans/${authData.uid}`);
}
});
}
示例6: constructor
constructor(private _af: AngularFire, private _auth: FirebaseAuth) {
this._allRecipes = _af.database.list('/recipes');
this._auth.subscribe(authData => {
if (authData) {
this._userRecipes = _af.database.list(`/recipes/${authData.uid}`);
}
});
}
示例7: ngOnInit
ngOnInit(): void {
this._auth.subscribe(authData => {
if (authData) {
this.username = authData.auth.displayName;
this.userImage = authData.auth.photoURL;
}
});
}
示例8: ngOnInit
ngOnInit() {
this.auth.subscribe((data) => {
console.log("in auth subscribe", data)
if (data) {
this.nav.setRoot(BulletinBoardPage);
}
});
}
示例9: constructor
constructor(private _af: AngularFire, private _auth: FirebaseAuth, private _nutrientService: NutrientService) {
this._auth.subscribe(authData => {
if (authData) {
this._profile = _af.database.object(`/profiles/${authData.uid}`);
}
});
this._nutrientService.getMicronutrients().subscribe(micronutrients => this._micronutrients = micronutrients);
this._nutrientService.getMacronutrients().subscribe(macronutrients => this._macronutrients = macronutrients);
}
示例10: constructor
constructor(private _auth: FirebaseAuth) {
this.loginEmail = "";
this.loginPassword = "";
this.error = false;
this.errorText = "";
this.loggedIn = false;
this._auth.subscribe(auth => {
if(auth && auth.auth.emailVerified) {
this.loggedIn = true;
}
else
this.loggedIn = false;
});
}