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


TypeScript firestore.AngularFirestore類代碼示例

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


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

示例1: updateUser

 private updateUser(data: any): Promise<void> {
   const userRef: AngularFirestoreDocument<any> = this.afs.doc(`users/${data.id}`);
   return userRef.set(data, { merge: true });
 }
開發者ID:Meistercoach83,項目名稱:sfw,代碼行數:4,代碼來源:auth.service.ts

示例2: constructor

 constructor(private db: AngularFirestore) { 
     this.rodadas = db.collection(config.rodadaDB);
 }
開發者ID:HermanoLeite,項目名稱:fodinha,代碼行數:3,代碼來源:rodada.service.ts

示例3: constructor

 constructor(private db: AngularFirestore, private jogoService: JogoService, private cookieService: CookieService) { 
     this.jogadores = db.collection(config.jogadorDB);
 }
開發者ID:HermanoLeite,項目名稱:fodinha,代碼行數:3,代碼來源:jogador.service.ts

示例4:

 col<T>(ref: CollectionPredicate<T>, queryFn?): AngularFirestoreCollection<T> {
     return typeof ref === 'string' ? this.afs.collection<T>(ref, queryFn) : ref;
 }
開發者ID:jacobbowdoin,項目名稱:RapidWords,代碼行數:3,代碼來源:firestore.service.ts

示例5: constructor

 constructor(private afs: AngularFirestore) {
   this.notesCollection = this.afs.collection('notes', (ref) => ref.orderBy('time', 'desc').limit(5));
 }
開發者ID:geeksmarter,項目名稱:andrews.codes,代碼行數:3,代碼來源:notes.service.ts

示例6: oAuthLogin

  private async oAuthLogin(provider) {
    const loginAction = await this.afAuth.auth.signInWithPopup(provider);
    const userRef = await this.afs.doc(`users/${loginAction.user.uid}`).valueChanges().pipe(first()).toPromise();

    const updateObject: any = {
      id: loginAction.user.uid,
      displayName: loginAction.user.displayName,
      emailVerified: true,
      email: loginAction.user.email,
      creationTime: loginAction.user.metadata.creationTime,
      lastSignInTime: loginAction.user.metadata.lastSignInTime
    };

    if (!userRef) {
      const registrationData = await this.applicationService.getAppData().toPromise();
      updateObject.assignedRoles = {
        admin: registrationData.registration && registrationData.registration === 'admin',
        editor: registrationData.registration && registrationData.registration === 'editor',
        subscriber: registrationData.registration && registrationData.registration === 'subscriber'
      };
    }
    return this.updateUser(updateObject);
  }
開發者ID:Meistercoach83,項目名稱:sfw,代碼行數:23,代碼來源:auth.service.ts

示例7: loginJobs

  loginJobs() {
    const user = this.afAuth.auth.currentUser;
    const userInfo: User = {
      uid: user.uid,
      displayName: user.displayName,
      email: user.email,
      phoneNumber: user.phoneNumber,
      photoURL: user.photoURL,
      logged:true
    }

    this.afs.
      collection<User>(`users`)
      .doc(user.uid)
      .set({ ...userInfo })
      .then(res => {
        console.log(res);
      }).catch(err => {
        alert(err)
      })
    this.storage.set('user', userInfo)
    this.events.publish('user:login', user)
  }
開發者ID:Microsmsm,項目名稱:Dawaey,代碼行數:23,代碼來源:auth.ts

示例8: savePhoto

    private async savePhoto(path: string, displayName: string, uid: string, lexeme: string, dictionaryId: string) {
        try {
            // tslint:disable:max-line-length
            const storagePath = 'https://anet-photo.appspot.com/urlfull/talking-dictionaries-' + (environment.production ? 'alpha' : 'dev') + '.appspot.com/' + path;

            const result = await this.http.get(storagePath, { responseType: 'text' }).toPromise();
            const gcsPath: string = result.replace('http://lh3.googleusercontent.com/', '');

            const pf: IPhoto = {
                path,
                gcs: gcsPath,
                ts: firestore.FieldValue.serverTimestamp(),
                cr: displayName,
                ab: uid,
            };

            const entryDoc = this.afs.doc(`dictionaries/${dictionaryId}/words/${this.entry.id}`);
            await entryDoc.update({ pf });
            this.snackBar.open(`Photo uploaded for ${lexeme}`, '', { duration: 3000 });
        } catch (err) {
            this.snackBar.open('Error Uploading Image. Please email Jacob image name and lexeme.', 'OK',
                { duration: 20000, panelClass: 'snackbar-error' });
        }
    }
開發者ID:jacobbowdoin,項目名稱:RapidWords,代碼行數:24,代碼來源:photo-upload.component.ts

示例9: updateJogo

 updateJogo(id, update) {
     this.jogosDoc = this.db.doc<Jogo>(`${config.jogoDB}/${id}`);
     this.jogosDoc.update(update);
 }
開發者ID:HermanoLeite,項目名稱:fodinha,代碼行數:4,代碼來源:jogo.service.ts

示例10:

 this.dictionariesService.currentDictionary.pipe(take(1)).subscribe(dictionary => {
   this.afs.collection(`dictionaries/${dictionary.id}/writeInCollaborators`).add(writeInCollaborator);
 });
開發者ID:jacobbowdoin,項目名稱:RapidWords,代碼行數:3,代碼來源:contributors.service.ts

示例11: getNote

 getNote(id: string) {
   return this.afs.doc<any>(`notes/${id}`);
 }
開發者ID:geeksmarter,項目名稱:andrews.codes,代碼行數:3,代碼來源:notes.service.ts

示例12: switchMap

 switchMap((dictionary) => {
   return this.afs.doc<DictionarySettings>(`dictionaries/${dictionary.id}/config/settings`).valueChanges();
 })
開發者ID:jacobbowdoin,項目名稱:RapidWords,代碼行數:3,代碼來源:settings.service.ts

示例13: deletejogador

 deletejogador(id, jogoId) {
     this.jogadorDoc = this.db.doc<Jogador>(`${config.jogoDB}/${jogoId}/${config.jogadorDB}/${id}`);
     this.jogadorDoc.delete();
 }
開發者ID:HermanoLeite,項目名稱:fodinha,代碼行數:4,代碼來源:jogador.service.ts

示例14: updatejogador

 updatejogador(id, update, jogoId) {
     this.jogadorDoc = this.db.doc<Jogador>(`${config.jogoDB}/${jogoId}/${config.jogadorDB}/${id}`);
     this.jogadorDoc.update(update);
 }
開發者ID:HermanoLeite,項目名稱:fodinha,代碼行數:4,代碼來源:jogador.service.ts

示例15: setJogo

 setJogo (jogoId) {
     this.jogadores = this.db.collection(config.jogoDB).doc(jogoId).collection(config.jogadorDB);
 }
開發者ID:HermanoLeite,項目名稱:fodinha,代碼行數:3,代碼來源:jogador.service.ts


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