「Cloud Firestore」の版間の差分
ナビゲーションに移動
検索に移動
| 20行目: | 20行目: | ||
) { } | ) { } | ||
| − | public getInformations( | + | public getInformations(): Observable<QuerySnapshot<DocumentData>> { |
const path = `${FS_PATH_INFORMATIONS}`; | const path = `${FS_PATH_INFORMATIONS}`; | ||
console.log(`get informations..[${path}]`); | console.log(`get informations..[${path}]`); | ||
2020年9月11日 (金) 15:59時点における版
| Angular | Firebase | TypeScript | Google Cloud Platform | ブログカテゴリ(Firebase) |
データの並べ替え
AngularFire
Collection
import { Observable } from 'rxjs';
import { AngularFirestore, QuerySnapshot, DocumentSnapshot, DocumentData } from '@angular/fire/firestore';
export const FS_PATH_INFORMATIONS = 'informations/';
constructor(
public firestore: AngularFirestore
) { }
public getInformations(): Observable<QuerySnapshot<DocumentData>> {
const path = `${FS_PATH_INFORMATIONS}`;
console.log(`get informations..[${path}]`);
return this.firestore.collection<InformationCard>(path).get();
}
ngOnInit(): void {
let outer = this;
this.bookService.getInformations().subscribe({
next(p){
p.forEach(d => {
outer.infoCards.push(d.data() as InformationCard);
});
}
});
}
© 2006 矢木浩人