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


TypeScript angularfire2.FirebaseObjectObservable類代碼示例

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


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

示例1: restaurantVote

   /**
     * @description Performs a vote for or against a restaurant
     * @param {Object} restaurant object to determine which restaurant is voted for/against
     */
    restaurantVote(restaurant){
        let isVotePresent = false;
              
        let dateKey = Utility.getTodayString();

        if(this.name === undefined) return;
        if(this.dates[dateKey][restaurant.id] === undefined){
            this.dates[dateKey][restaurant.id] = {};
        }

        Object.keys(this.dates).forEach(key => {
          if(!this.dates[key] || !this.dates[key][restaurant.id]) return;
          if(this.dates[key][restaurant.id][this.name]) isVotePresent = true;
        });

        if(isVotePresent){
            // vote present, vote against it
            this.dates[dateKey][restaurant.id][this.name] = !this.dates[dateKey][restaurant.id][this.name];
        } else {
            // vote not present, add it as positive
            this.dates[dateKey][restaurant.id][this.name] = true;
        }
        delete this.dates.$key;
        this.votes.update(this.dates);

    }
開發者ID:MartinNuc,項目名稱:usertech-lunch-app,代碼行數:30,代碼來源:item.component.ts

示例2: getMatchesToBetAndToPlay

  getMatchesToBetAndToPlay():Observable<Array<Match>> {
    return this.matches$.flatMap((matches:Array<Match>) => {
      let matchesToPlay = matches.filter(match => match.status == Status.TO_PLAY);

      return this.filterMatchesByDayIdAvailable(matchesToPlay);
    });
  }
開發者ID:ojacquemart,項目名稱:ng2-euro-bets,代碼行數:7,代碼來源:matches.service.ts

示例3: getMatchesOfGroupPhase

 getMatchesOfGroupPhase():Observable<Array<Match>> {
   return this.matches$.flatMap((matches:Array<Match>) => {
     return Observable.of(this.filterMatchesByDayId(matches, PHASE_GROUP_MAX_DAY_ID))
       .flatMap((matches:Array<Match>) => {
         return this.associateWithUserBet(matches);
       });
   });
 }
開發者ID:ojacquemart,項目名稱:ng2-euro-bets,代碼行數:8,代碼來源:matches.service.ts

示例4: getGroups

  getGroups():Observable<Array<GroupTable>> {
    console.log('groups @ get groups');
    this.loadingState.start();

    return this.groups$.flatMap((groups:Array<Group>) => {
        console.log('groups @ group matches by phase code');
        return this.associateGroupWithMatches(groups);
      })
      .do(() => this.loadingState.stop());
  }
開發者ID:arcava,項目名稱:ng2-euro-bets,代碼行數:10,代碼來源:groups.service.ts

示例5: constructor

 constructor(private af: AngularFire){
   this.votes = af.database.object('/votes');
   this.votes.subscribe((res) => {
       this.dates = res;
   });
   this.dishes = [
     {
     "distance":"0.13808051082295206",
     "restaurant_name":"Restaurace K The Two Brothers",
     "rating":92,
     "id_restaurant":2172,
     "lat":50.0912692,
     "long":"14.43358390000003",
     "name":"Butter naan",
     "description":"Indick\u00fd chl\u00e9b pot\u0159en\u00fd m\u00e1slem.",
     "ammount":null,
     "price":50,
     "image_url":"https:\/\/www.restu.cz\/ir\/restaurant\/0db\/0db0d6d486eb69ed829b762f83e618f5.jpg"
  },
  {
     "distance":"0.13808051082295206",
     "restaurant_name":"Restaurace K The Two Brothers",
     "rating":92,
     "id_restaurant":2172,
     "lat":50.0912692,
     "long":"14.43358390000003",
     "name":"Plain Roti",
     "description":"Celozrnn\u00fd chl\u00e9b pe\u010den\u00fd v peci Tandoor.",
     "ammount":null,
     "price":40,
     "image_url":"https:\/\/www.restu.cz\/ir\/restaurant\/0db\/0db0d6d486eb69ed829b762f83e618f5.jpg"
  },
  {
     "distance":"0.1452246946411884",
     "restaurant_name":"Bistro Tobruk",
     "rating":83,
     "id_restaurant":1262,
     "lat":"50.09184385046584",
     "long":"14.432612404264432",
     "name":"Croissant",
     "description":"s dom\u00e1c\u00ed marmel\u00e1dou a m\u00e1slem",
     "ammount":null,
     "price":49,
     "image_url":"https:\/\/www.restu.cz\/ir\/restaurant\/283\/283537b3fd8e356d9ff13cd10dd39b1a.jpg"
  }
   ]
 }
開發者ID:MartinNuc,項目名稱:usertech-lunch-app,代碼行數:47,代碼來源:item.component.ts

示例6: getMatchesToBet

 private getMatchesToBet():Observable<Array<Match>> {
   return this.matches$.flatMap((matches:Array<Match>) => {
     return this.filterMatchesByDayIdAvailable(matches);
   });
 }
開發者ID:ojacquemart,項目名稱:ng2-euro-bets,代碼行數:5,代碼來源:matches.service.ts


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