过滤 FirebaseListObservable
Filtering FirebaseListObservable
我正在尝试过滤我的 FirebaseListObservable:
import 'rxjs/add/operator/filter';
...
jobListRef$: FirebaseListObservable<Job[]>;
...
this.jobListRef$ = this.database.list('job-list',
{ query:
{
orderByChild: "state",
equalTo: "passive"
}
}).filter(item => item.employer === this.afAuth.auth.currentUser.uid));
但我得到的只是:
Type 'Observable< any>' is not assignable to type 'FirebaseListObservable< Job[]>'. Property '$ref' is missing in type 'Observable< any>'.
我看到这个问题应该已经在 angularfire2@^2.0.0-beta.7.1-pre 中修复了,但我使用 angularfire2@^4.0 .0-rc.2
首先你需要升级到latest。之后:
jobListRef$: Observable<Job[]>;
this.jobListRef$ = this.database.list('job-list', query =>
{
return query.orderByChild("state").equalTo("active");
}
).valueChanges();
我正在尝试过滤我的 FirebaseListObservable:
import 'rxjs/add/operator/filter';
...
jobListRef$: FirebaseListObservable<Job[]>;
...
this.jobListRef$ = this.database.list('job-list',
{ query:
{
orderByChild: "state",
equalTo: "passive"
}
}).filter(item => item.employer === this.afAuth.auth.currentUser.uid));
但我得到的只是:
Type 'Observable< any>' is not assignable to type 'FirebaseListObservable< Job[]>'. Property '$ref' is missing in type 'Observable< any>'.
我看到这个问题应该已经在 angularfire2@^2.0.0-beta.7.1-pre 中修复了,但我使用 angularfire2@^4.0 .0-rc.2
首先你需要升级到latest。之后:
jobListRef$: Observable<Job[]>;
this.jobListRef$ = this.database.list('job-list', query =>
{
return query.orderByChild("state").equalTo("active");
}
).valueChanges();