• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript firestore.AngularFirestore类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@angular/fire/firestore.AngularFirestore的典型用法代码示例。如果您正苦于以下问题:TypeScript AngularFirestore类的具体用法?TypeScript AngularFirestore怎么用?TypeScript AngularFirestore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了AngularFirestore类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: constructor

 constructor(
     private afs: AngularFirestore
 ) {
     this.booksCollection = this.afs.collection('books');
 }
开发者ID:azazely85,项目名称:angulartech,代码行数:5,代码来源:books.service.ts


示例7: 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


示例8: 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


示例9: 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


示例10: updateJogo

 updateJogo(id, update) {
     this.jogosDoc = this.db.doc<Jogo>(`${config.jogoDB}/${id}`);
     this.jogosDoc.update(update);
 }
开发者ID:HermanoLeite,项目名称:fodinha,代码行数:4,代码来源:jogo.service.ts


示例11:

 this.dictionariesService.currentDictionary.pipe(take(1)).subscribe(dictionary => {
   this.afs.collection(`dictionaries/${dictionary.id}/writeInCollaborators`).add(writeInCollaborator);
 });
开发者ID:jacobbowdoin,项目名称:RapidWords,代码行数:3,代码来源:contributors.service.ts


示例12: getNote

 getNote(id: string) {
   return this.afs.doc<any>(`notes/${id}`);
 }
开发者ID:geeksmarter,项目名称:andrews.codes,代码行数:3,代码来源:notes.service.ts


示例13: switchMap

 switchMap((dictionary) => {
   return this.afs.doc<DictionarySettings>(`dictionaries/${dictionary.id}/config/settings`).valueChanges();
 })
开发者ID:jacobbowdoin,项目名称:RapidWords,代码行数:3,代码来源:settings.service.ts


示例14: 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


示例15: 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


示例16: setJogo

 setJogo (jogoId) {
     this.jogadores = this.db.collection(config.jogoDB).doc(jogoId).collection(config.jogadorDB);
 }
开发者ID:HermanoLeite,项目名称:fodinha,代码行数:3,代码来源:jogador.service.ts


示例17:

  public getCollection$(userId: string, query?): Observable<Day[]> {

    return this.angularFirestore.collection<Day>(`users/${userId}/timesheet`).valueChanges();
  }
开发者ID:adolfolopez88,项目名称:Store,代码行数:4,代码来源:timesheet.service.ts


示例18: add

 public add(userId: string, data: Day): Promise<DocumentReference> {
   return this.angularFirestore.collection<Day>(`users/${userId}/timesheet`).add(data);
 }
开发者ID:adolfolopez88,项目名称:Store,代码行数:3,代码来源:timesheet.service.ts


示例19: deleteJogo

 deleteJogo(id) {
     this.jogosDoc = this.db.doc<Jogo>(`${config.jogoDB}/${id}`);
     this.jogosDoc.delete();
 }
开发者ID:HermanoLeite,项目名称:fodinha,代码行数:4,代码来源:jogo.service.ts


示例20: createshippings

  createshippings(data: Billing) {
    //this.shippings.push(data);
    this.db.collection('shippings').add(data);

  }
开发者ID:BennyRJZ,项目名称:kubeet-landing,代码行数:5,代码来源:shipping.service.ts



注:本文中的@angular/fire/firestore.AngularFirestore类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap