| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

Cloud Firestore

提供: MyMemoWiki
2020年9月11日 (金) 15:57時点におけるPiroto (トーク | 投稿記録)による版 (→‎AngularFire)
ナビゲーションに移動 検索に移動

| Angular | Firebase | TypeScript | Google Cloud Platform | ブログカテゴリ(Firebase) |

データの並べ替え

AngularFire

Collection

  1. import { Observable } from 'rxjs';
  2. import { AngularFirestore, QuerySnapshot, DocumentSnapshot, DocumentData } from '@angular/fire/firestore';
  3.  
  4. constructor(
  5. public firestore: AngularFirestore
  6. ) { }
  7.  
  8. public getInformations(user?: User): Observable<QuerySnapshot<DocumentData>> {
  9. const path = `${FS_PATH_INFORMATIONS}`;
  10. console.log(`get informations..[${path}]`);
  11. return this.firestore.collection<InformationCard>(path).get();
  12. }
  1. ngOnInit(): void {
  2. let outer = this;
  3. this.bookService.getInformations().subscribe({
  4. next(p){
  5. p.forEach(d => {
  6. outer.infoCards.push(d.data() as InformationCard);
  7. });
  8. }
  9. });
  10. }