2
저는 Angular4 (4.3.6) 및 AngularFire2 (4.0.0-rc.2)를 사용합니다.AngularFire2 - db.object로 단일 개체 가져 오기 - 데이터가 늦게 수신 됨
// GET THE ID
this.id = this.route.snapshot.params['id'];
this.subscriptions.push(
this.db.object('/restaurants/' + this.id).subscribe(data => {
this.restaurant = data;
console.log(data);
})
);
이러한 방법으로, 나는 데이터를 얻을 수 있지만, 콘솔 던져 오류는 데이터가 너무 조금 늦게 오기 때문에 : 내가 가진 자세히보기에 대한 데이터를 얻을. 마침내 나는 route.params에서 ID를 얻고 싶지 않습니다. 나중에 객체 이름을 상세 뷰의 경로로 사용하기를 원하기 때문입니다. 여기
StackBlitz : https://stackblitz.com/edit/angular-7gabaq?file=sites/site-restaurant-detail/site-restaurant-detail.component.ts ("보기 식당"을 클릭)