當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript angularfire2.FirebaseAuth類代碼示例

本文整理匯總了TypeScript中angularfire2.FirebaseAuth的典型用法代碼示例。如果您正苦於以下問題:TypeScript FirebaseAuth類的具體用法?TypeScript FirebaseAuth怎麽用?TypeScript FirebaseAuth使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了FirebaseAuth類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

  constructor(public auth$: FirebaseAuth) {
    this.authState = auth$.getAuth();

    auth$.subscribe((state: FirebaseAuthState) => {
      this.authState = state;
    });
  }
開發者ID:xap5xap,項目名稱:CarMaintenanceWeb,代碼行數:7,代碼來源:auth.service.ts

示例2: constructor

 constructor( private auth$: FirebaseAuth) {
 //  / this.authState = auth$.getAuth();
   auth$.subscribe((state: FirebaseAuthState) => {
     this.authState = state;
     console.log(this.authState); 
   });    
 }
開發者ID:ohanspace,項目名稱:ng2-badhan-web,代碼行數:7,代碼來源:auth.service.ts

示例3: constructor

 constructor(private _af: AngularFire, private _auth: FirebaseAuth) {
   this._auth.subscribe(authData => {
     if (authData) {
       this._mealPlans = _af.database.list(`/meal-plans/${authData.uid}`);
     }
   });
 }
開發者ID:marcelpetersen,項目名稱:life-guide-hybrid,代碼行數:7,代碼來源:meal-plans.service.ts

示例4: 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;
            }
        })
    }
開發者ID:myersjj,項目名稱:Health-Tracker-SAM,代碼行數:29,代碼來源:sam.auth.ts

示例5: loginTwitter

 loginTwitter() {
   this.auth.login({
     provider: AuthProviders.Twitter
   }).then(() => {
     this.nav.setRoot(ChatPage);
   });
 }
開發者ID:akserg,項目名稱:Meetup_ionic_7.5.16,代碼行數:7,代碼來源:hello.ts

示例6: login

  login(credentials) {
    let loading = Loading.create({
      content: "Por favor aguarde..."
    });
    this.navCtrl.present(loading);

    this.auth.login(credentials, {
      provider: AuthProviders.Password,
      method: AuthMethods.Password
    }).then((authData) => {
      console.log(authData);
      loading.dismiss();
      this.navCtrl.popToRoot();
    }).catch((error) => {
      loading.dismiss();
      if (error) {
        switch (error.code) {
          case "INVALID_EMAIL":
            this.error = "E-mail invรกlido.";
            break;
          case "INVALID_USER":
            this.error = "E-mail ou senha incorretos.";
            break;
          case "INVALID_PASSWORD":
            this.error = "E-mail ou senha incorretos.";
            break;
          case "NETWORK_ERROR":
            this.error = "Aconteceu algum erro ao tentar se conectar ao servidor, tente novamente mais tarde.";
            break;
          default:
            this.error = error;
        }
      }
    });
  }
開發者ID:jimmyloh,項目名稱:Ionic2FirebaseStarter,代碼行數:35,代碼來源:login-email.ts

示例7: _login

	private _login(authType: AuthProviders) {
		this.firebaseAuth.login({
			provider: authType
		}).then((authData: any) => {
			authData.auth.token.firebase = null; // remove array
			this.angularFire.object('/users/' + authData.uid + '/authData').set(authData);
		}).catch(err => console.log('Login Failed', err));
	}
開發者ID:supermarcos,項目名稱:focus,代碼行數:8,代碼來源:auth.service.ts

示例8:

	ngOnInit() {
		this.auth.subscribe((data) => {
			console.log("in auth subscribe", data)
			if (data) {
				this.nav.setRoot(BulletinBoardPage);
			} 
		});
	}
開發者ID:lgmbarata,項目名稱:eCondominio,代碼行數:8,代碼來源:login.ts

示例9: ngOnInit

 ngOnInit(): void {
   this._auth.subscribe(authData => {
     if (authData) {
       this.username = authData.auth.displayName;
       this.userImage = authData.auth.photoURL;
     }
   });
 }
開發者ID:marcelpetersen,項目名稱:life-guide-hybrid,代碼行數:8,代碼來源:home.ts

示例10: loginUser

 loginUser(email:string, password:string):Promise<any>{
   return this.auth.login({
     email: email,
     password: password
   })
   .then(user => Promise.resolve( user ))
   .catch(error => Promise.reject( error ));
 }
開發者ID:EscuelaIt,項目名稱:class-10-demo,代碼行數:8,代碼來源:auth.ts


注:本文中的angularfire2.FirebaseAuth類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。