本文整理汇总了TypeScript中angularfire2.FirebaseListObservable.map方法的典型用法代码示例。如果您正苦于以下问题:TypeScript FirebaseListObservable.map方法的具体用法?TypeScript FirebaseListObservable.map怎么用?TypeScript FirebaseListObservable.map使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angularfire2.FirebaseListObservable
的用法示例。
在下文中一共展示了FirebaseListObservable.map方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(plannedExoensesService: PlannedExpensesService, exoensesService: ExpensesService) {
this.plannedExpenses = plannedExoensesService.get();
this.expenses = exoensesService.get();
this.lineChart = new LineChart();
// this.lineChart.addDataSet();
this.data = this.expenses.map((next) => {
var months: any[] = [];
var totalExpenses: number[] = [];
Observable.from<IExpenses>(next).groupBy((k) => {
return new Date(k.at).getMonth() + 1;
}).map((a) => {
months.push(a.key);
var sum = 0;
a.subscribe((s) => {
sum += s.amount;
}, () => { }, () => {
totalExpenses.push(sum);
});
}).subscribe();
var chartData: ChartData = new ChartData(totalExpenses, months.sort());
return chartData;
});
}
示例2: filter
filter(term: string) {
return this.professors.map(professors =>
professors.filter(professor => {
return professor.firstName.indexOf(term) >= 0 ? true : false;
}
)
);
}
示例3: getProfessorsFrom
getProfessorsFrom(discipline: string) {
let pos = this.convertToPositionArrayCanGive(discipline);
return this.professors.map(professors =>
professors.filter(professor => {
return professor.canGive[pos];
}
)
);
}
示例4: getAll
getAll(uid?: string, search?: string) {
return this.spices.map((spices) => {
return spices
.filter(item => this.filter(item, uid, search))
.sort(function (a, b) {
return b.timestamp - a.timestamp;
});
});
}
示例5: setup
setup(endpoint : string, query?) : Observable<T[]> {
this.endpoint = endpoint;
this.firebaseList = this.af.database.list(endpoint, query);
this.list = this.firebaseList.map(rawTSet =>
rawTSet.map( rawTData =>
rawTData
)
);
return this.list;
}
示例6: getProfessorsByType
getProfessorsByType(type: number) {
return this.professors.map(professors =>
professors.filter(professor => {
if (professor.canGive !== undefined) {
return professor.canGive[type];
}
}
)
);
}
示例7: filter
filter(term: string) {
return this.students.map(students =>
students.filter(student => {
if (student.firstName.indexOf(term) >= 0 || student.lastName.indexOf(term) >= 0) {
return true;
} else {
return false;
}
}
)
);
}
示例8: filter
filter(term: string) {
return this.classes.map(classes =>
classes.filter(classT =>
{
if (classT.name.indexOf(term) >= 0) {
return true;
} else {
return false;
}
}
)
);
}
示例9: getStudentsWithoutThis
getStudentsWithoutThis(type: string, keyClass: string) {
return this.students.map(students =>
students.filter(student => {
if (type === 'cc') {
return true;
} else {
if (student.classes[type] === keyClass || student.classes[type] === '') {
return true;
} else {
return false;
}
}
}
)
);
}
示例10: getStudentsFrom
getStudentsFrom(discipline: string) {
return this.students.map(students =>
students.filter(student => {
if (discipline === 'cc') {
if (student.classes !== undefined && student.classes.cc !== undefined) {
return true;
} else {
return false;
}
}
if (student.classes[discipline] !== '') {
return true;
} else {
return false;
}
}
)
);
}