当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript AngularFireDatabase.object方法代码示例

本文整理汇总了TypeScript中@angular/fire/database.AngularFireDatabase.object方法的典型用法代码示例。如果您正苦于以下问题:TypeScript AngularFireDatabase.object方法的具体用法?TypeScript AngularFireDatabase.object怎么用?TypeScript AngularFireDatabase.object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@angular/fire/database.AngularFireDatabase的用法示例。


在下文中一共展示了AngularFireDatabase.object方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

 .then(() => {
   this.db.object<any>(`/teamPayments/${this.UI.currentTeam}/${this.newPaymentID}/response/outcome`).snapshotChanges().subscribe(paymentSnapshot => {
     if (paymentSnapshot.payload.val().seller_message != null) { this.messagePayment = paymentSnapshot.payload.val().seller_message; }
     if (this.messagePayment == 'Payment complete.') { this.messagePERRINNTransaction = 'We are now sending COINS to your team...'; }
   });
   this.db.object<any>(`/teamPayments/${this.UI.currentTeam}/${this.newPaymentID}/error`).snapshotChanges().subscribe(paymentSnapshot => {
     if (paymentSnapshot.payload.val().message != null) { this.messagePayment = paymentSnapshot.payload.val().message; }
   });
   this.db.object<any>(`/teamPayments/${this.UI.currentTeam}/${this.newPaymentID}/PERRINNTransaction`).snapshotChanges().subscribe(transactionSnapshot => {
     if (transactionSnapshot.payload.val().message != null) { this.messagePERRINNTransaction = transactionSnapshot.payload.val().message; }
   });
 });
开发者ID:PERRINN,项目名称:client-web,代码行数:12,代码来源:buyCoins.component.ts

示例2:

    this.route.params.subscribe(params => {
      this.UI.currentTeam = params.id;
      this.isCurrentUserLeader = false;
      this.isCurrentUserMember = false;
      this.showDetails = {};
      db.object('PERRINNTeams/' + this.UI.currentTeam).valueChanges().subscribe(snapshot => {
        this.UI.currentTeamObj = snapshot;
        this.UI.currentTeamObjKey = this.UI.currentTeam;
        if (this.UI.currentUser) {
          if (this.UI.currentTeamObj.leaders != undefined) {
            this.isCurrentUserLeader = this.UI.currentTeamObj.leaders[UI.currentUser] ? true : false;
          }
          if (this.UI.currentTeamObj.members != undefined) {
            this.isCurrentUserMember = this.UI.currentTeamObj.members[UI.currentUser] ? true : false;
          }
        }
      });
      db.object('PERRINNTeams/' + this.UI.currentTeam + '/chatReplayMode').valueChanges().subscribe(snapshot => {
        if (snapshot != undefined) {
          this.chatReplayMode = snapshot ? true : false;
        }
        this.previousMessageTimestamp = 0;
        this.previousMessageUser = '';
        this.draftMessageDB = false;
        this.draftImage = '';
        this.draftImageDownloadURL = '';
        this.draftMessage = '';
        this.messageNumberDisplay = 15;
        this.teamMessages = this.db.list('teamMessages/' + this.UI.currentTeam, ref => ref.limitToLast(this.messageNumberDisplay)).snapshotChanges().pipe(map(changes => {
          this.UI.loading = false;
          const updateObj = {};
          changes.forEach(c => {
            updateObj['teamReads/' + this.UI.currentUser + '/' + this.UI.currentTeam + '/' + c.payload.key] = true;
          });
          this.db.database.ref().update(updateObj);
          return changes.map(c => ({key: c.payload.key, values: c.payload.val()}));
        }));
        if (this.chatReplayMode) {
          this.chatReplayLoop();
        }
        this.draftMessageUsers = this.db.list('teamActivities/' + this.UI.currentTeam + '/draftMessages/').snapshotChanges().pipe(map(changes => {
          return changes.map(c => ({key: c.payload.key, values: c.payload.val()}));
        }));

        afs.doc<any>('PERRINNTeams/'+this.UI.currentUser+'/viewTeams/'+this.UI.currentTeam).valueChanges().subscribe(userTeam => {
          if (userTeam!=null&&userTeam.lastChatVisitTimestamp!=undefined) {this.lastChatVisitTimestamp = Number(userTeam.lastChatVisitTimestamp); }
          else this.lastChatVisitTimestamp=0;
        });
      });
    });
开发者ID:PERRINN,项目名称:client-web,代码行数:50,代码来源:chat.component.ts

示例3: if

 this.afAuth.user.subscribe((auth) => {
   if (auth != null) {
     this.currentUser = auth.uid;
     this.db.object('PERRINNTeams/' + this.currentUser).valueChanges().subscribe(snapshot => {
       this.currentUserObj = snapshot;
     });
     afs.collection<any>('PERRINNTeams/'+this.currentUser+'/viewTeams/').valueChanges().subscribe(snapshot => {
       this.currentUserTeamsObj = snapshot;
       this.globalChatActivity = false;
       snapshot.forEach(userTeam => {
         let chatActivity:boolean=false;
         if(userTeam.lastChatVisitTimestamp!=undefined)chatActivity=(userTeam.lastMessageTimestamp>userTeam.lastChatVisitTimestamp);
         else if(userTeam.lastMessageTimestamp!=undefined)chatActivity=true;
         else chatActivity=false;
         if (chatActivity) {
           this.globalChatActivity = true;
         }
         document.title = this.globalChatActivity ? '(!) PERRINN' : 'PERRINN';
       });
     });
     if (this.focusUser == null) { this.focusUser = auth.uid; }
     this.db.database.ref('appSettings/PERRINNServices/').once('value').then(services => {
       this.services = services;
     });
   } else {
     this.currentUser = null;
     this.focusUser = null;
     this.currentTeam = null;
   }
 });
开发者ID:PERRINN,项目名称:client-web,代码行数:30,代码来源:userInterface.service.ts

示例4:

 this.route.params.subscribe(params => {
   this.UI.currentTeam = params.id;
   this.teamLeaders = this.db.list('PERRINNTeams/' + this.UI.currentTeam + '/leaders').snapshotChanges().pipe(map(changes => {
     return changes.map(c => ({
       key: c.payload.key,
       values: c.payload.val(),
       name: this.db.object('PERRINNTeams/' + c.payload.key + '/name').valueChanges(),
       imageUrlThumb: this.db.object('PERRINNTeams/' + c.payload.key + '/imageUrlThumb').valueChanges(),
     }));
   }));
   this.teamMembers = this.db.list('PERRINNTeams/' + this.UI.currentTeam + '/members').snapshotChanges().pipe(map(changes => {
     return changes.map(c => ({
       key: c.payload.key,
       values: c.payload.val(),
       name: this.db.object('PERRINNTeams/' + c.payload.key + '/name').valueChanges(),
       imageUrlThumb: this.db.object('PERRINNTeams/' + c.payload.key + '/imageUrlThumb').valueChanges(),
     }));
   }));
   this.db.object('PERRINNTeams/' + this.UI.currentTeam + '/parent').snapshotChanges().subscribe(changes => {
     this.parent = changes.payload.val().toString();
     this.parentName = this.db.object('PERRINNTeams/' + this.parent + '/name').valueChanges();
     this.parentImageUrlThumb = this.db.object('PERRINNTeams/' + this.parent + '/imageUrlThumb').valueChanges();
   });
   this.teamChildren = this.db.list('PERRINNTeams/' + this.UI.currentTeam + '/children').snapshotChanges().pipe(map(changes => {
     return changes.map(c => ({
       key: c.payload.key,
       values: c.payload.val(),
       name: this.db.object('PERRINNTeams/' + c.payload.key + '/name').valueChanges(),
       imageUrlThumb: this.db.object('PERRINNTeams/' + c.payload.key + '/imageUrlThumb').valueChanges(),
     }));
   }));
 });
开发者ID:PERRINN,项目名称:client-web,代码行数:32,代码来源:teamProfile.component.ts

示例5: authorPage

 authorPage(authorKey) {
     this.db.object('users/' + authorKey).valueChanges().subscribe(response => {
         console.log("Author Key:", authorKey);
         console.log("Response:", response);
         response["key"] = authorKey;
         
         this.navCtrl.push(UserPage, response, {animate: true, animation: 'wp-transition', direction: 'forward'});
     });
 }
开发者ID:lazaryo,项目名称:poetry-manager,代码行数:9,代码来源:poems.ts

示例6: updateDraftMessageDB

 updateDraftMessageDB() {
   if ((this.draftMessage != '') != this.draftMessageDB) {
     this.db.object('teamActivities/' + this.UI.currentTeam + '/draftMessages/' + this.UI.currentUser).update({
       name: this.UI.currentUserObj.name,
       draftMessage: this.draftMessage != '',
       draftMessageTimestamp: firebase.database.ServerValue.TIMESTAMP,
     });
   }
   this.draftMessageDB = (this.draftMessage != '');
 }
开发者ID:PERRINN,项目名称:client-web,代码行数:10,代码来源:chat.component.ts

示例7: constructor

  constructor(
		public db: AngularFireDatabase,
		private fireAuth : AngularFireAuth, 
		public navCtrl: NavController, 
		public navParams: NavParams, 
		public menuCtrl: MenuController, 
		platform: Platform,
		private loadingCtrl: LoadingController
  	) {

  	this.notification = db.object('users/'+fireAuth.auth.currentUser.uid+'/notifications/'+this.navParams.data.notifID).snapshotChanges().pipe(map(c => 
  		({ 
  			key: c.payload.key, ...c.payload.val()}
        )));
  	db.object('users/'+fireAuth.auth.currentUser.uid+'/notifications/'+this.navParams.data.notifID).update({
  		notificationUnread: 0
  	});

  }
开发者ID:nmrisrl11,项目名称:Ecrotion_Buyer,代码行数:19,代码来源:buyer-notification-details.ts

示例8: followTeam

 followTeam(teamID: string, userID: string) {
   const now = Date.now();
   this.afs.doc<any>('PERRINNTeams/'+userID+/viewTeams/+teamID).update({
     lastChatVisitTimestamp: now,
     name: this.UI.currentTeamObj.name,
     imageUrlThumb: this.UI.currentTeamObj.imageUrlThumb ? this.UI.currentTeamObj.imageUrlThumb : '',
   });
   this.db.object('subscribeTeamUsers/' + teamID).update({
     [userID]: true,
   });
 }
开发者ID:PERRINN,项目名称:client-web,代码行数:11,代码来源:chat.component.ts

示例9: timestampChatVisit

 timestampChatVisit() {
   if (this.currentTeamObjKey != this.currentTeam) {return; }
   const now = Date.now();
   this.afs.doc<any>('PERRINNTeams/'+this.currentUser+/viewTeams/+this.currentTeam).update({
     lastChatVisitTimestamp: now,
     name: this.currentTeamObj.name,
     imageUrlThumb: this.currentTeamObj.imageUrlThumb ? this.currentTeamObj.imageUrlThumb : '',
   });
   this.db.object('subscribeTeamUsers/' + this.currentTeam).update({
     [this.currentUser]: true,
   });
 }
开发者ID:PERRINN,项目名称:client-web,代码行数:12,代码来源:userInterface.service.ts

示例10: map

 this.route.params.subscribe(params => {
   this.UI.focusUser = params.id;
   db.object('PERRINNTeams/' + this.UI.focusUser).valueChanges().subscribe(snapshot => {
     this.UI.focusUserObj = snapshot;
   });
   this.viewTeams=afs.collection('PERRINNTeams').doc(this.UI.focusUser).collection('viewTeams',ref=>ref.orderBy('lastMessageTimestamp','desc')).snapshotChanges().pipe(
     map(actions=>actions.map(a=>{
       const values=a.payload.doc.data();
       const key=a.payload.doc.id;
       this.UI.loading = false;
       return {key,values};
     }))
   );
 });
开发者ID:PERRINN,项目名称:client-web,代码行数:14,代码来源:userProfile.component.ts


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