0
Firestore는 data
이라는 모음에서 수집 한 데이터를 검색/표시 할 수없는 것처럼 보입니다. 이것은 코드를 단순화하려고 시도한 이후로 시작되었습니다.Firestore에서 데이터를 검색/표시 할 수 없습니다.
파일 이름 : 여기
내 코드의 database.component.tsimport { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { AngularFirestore, AngularFirestoreDocument, AngularFirestoreCollection } from 'angularfire2/firestore';
export interface Data {
P_U: string;
R_I: string;
R_P: string;
D_A: string;
}
export interface DataID extends Data {
id: string;
}
@Component({ ... })
export class DatabaseComponent implements OnInit {
private dataCollection: AngularFirestoreCollection<Data>;
public datas: Observable<DataID[]>;
constructor(private readonly afs: AngularFirestore) {
this.dataCollection = afs.collection<Data>('data', ref => ref.orderBy('Date', 'asc'));
this.datas = this.dataCollection.snapshotChanges().map(actions => {
return actions.map(a => {
const data = a.payload.doc.data() as Data;
const id = a.payload.doc.id;
return { id, ...data };
});
});
}
ngOnInit() {}
}
파일 이름 : database.component.html
<div class="section grey darken-4">
<div class="container row center white-text">
<h2>Back-End Database</h2>
<p class="flow-text">Reveal all protected back-ends here</p>
<a class="waves-effect waves-light btn purple">
<i class="material-icons left">chevron_right</i>
New Data
</a>
</div>
</div>
<div class="section grey darken-4">
<div class="container row white-text">
<p class="flow-text">Database Entries</p>
<table class="responsive-table">
<thead>
<tr>
<th>Protected URL</th>
<th>Revealed IP</th>
<th>Revealed Port</th>
<th>Date Added</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of datas | async">
<td>{{ data.P_U }}</td>
<td>{{ data.R_I }}</td>
<td>{{ data.R_P }}</td>
<td>{{ data.D_A }}</td>
</tr>
</tbody>
</table>
</div>
</div>
중포 기지 컬렉션 :
,451,515,추가 정보 :
@angular/animations: 5.1.2
@angular/common: 5.0.0
@angular/compiler: 5.0.0
@angular/core: 5.0.0
@angular/forms: 5.0.0
@angular/http: 5.0.0
@angular/platform-browser: 5.0.0
@angular/platform-browser-dynamic: 5.0.0
@angular/router: 5.0.0
angular2-materialize: 15.1.10
angularfire2: 5.0.0-rc.5-next
core-js: 2.4.1
firebase: 4.8.0
hammerjs: 2.0.8
jQuery: 3.2.1
materialize-css: 0.100.2
ngx-toastr: 8.0.0
rxjs: 5.5.2
zone.js: 0.8.14
당신은 내 Source Code in GitHub
예상 결과를 통해 내 문제를 재현을 시도 할 수 있습니다 :
모든 데이터가 dashboard.component.html
에 표시 할
현재 결과 :
모든 데이터도
표시되지 않습니다 내가 잘못된 곳이 있습니까?
젠장, 네 말이 맞아. 오, 그 부분 XD를 간과 했어. – Etosticity