本文整理匯總了TypeScript中angularfire2/angularfire2.AngularFire.list方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript AngularFire.list方法的具體用法?TypeScript AngularFire.list怎麽用?TypeScript AngularFire.list使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類angularfire2/angularfire2.AngularFire
的用法示例。
在下文中一共展示了AngularFire.list方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getNews
getNews():Observable<Array<News>> {
console.log('newscastcenter @ get news');
return this.af.list('/newscast/news')
.map(news => news.map(item => {
item.day = MatchHelper.formatTimestamp(item.timestamp);
return item;
}));
}
示例2: getStats
getStats():Observable<Array<Stat>> {
console.log('newscastcenter @ get stats');
let fixturesMap:Observable<Map<number,Match>> = this.matches.getMatchesWithUserBets()
.map((matches:Array<Match>) => {
let matchesIndexed:any = matches.map((match:Match) => {
return [match.number, match];
});
return new Map<number,Match>(matchesIndexed);
});
return Observable.zip(this.af.list('/newscast/stats'), fixturesMap, (stats:Array<Stat>, matchesByNumber:Map<number, Match>) => {
let statsWithMatch = stats.map((stat:Stat) => {
let match = matchesByNumber.get(stat.matchNumber);
stat.match = match;
stat.day = MatchHelper.formatTimestamp(match.timestamp);
stat.lastBetFormatted = moment(stat.lastBetTimestamp).format('HH:mm:ss');
return stat;
});
return _.orderBy(statsWithMatch, 'matchNumber', 'desc');
})
}