本文整理汇总了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);
}
示例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);
});
}
示例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);
});
});
}
示例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());
}
示例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"
}
]
}
示例6: getMatchesToBet
private getMatchesToBet():Observable<Array<Match>> {
return this.matches$.flatMap((matches:Array<Match>) => {
return this.filterMatchesByDayIdAvailable(matches);
});
}