当前位置: 首页>>代码示例>>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;未经允许,请勿转载。