【发布时间】:2018-11-15 20:35:36
【问题描述】:
我做了这个功能:
getAllUserLikedProperties(): AngularFirestoreCollection<any> {
return this.afs.collection('users', ref =>
ref.where('uid', '==', this._auth.currentUserId)
.where('likedProp', '==', true)
);
}
我试着这样称呼它:
ngOnInit() {
this._property.getAllUserLikedProperties().subscribe(likedProp => {
console.log(likedProp);
this.likedProp = likedProp;
});
}
但是它返回这个错误:
ERROR TypeError: this._property.getAllUserLikedProperties is not a function
有人知道为什么吗?知道我应该怎么称呼它吗?
【问题讨论】:
-
什么是
this._property? -
什么是
_property? -
@dfsq public _property: PropertyService(链接到我创建该函数的服务)
-
@sabithpocker 我已经在上面回答了,但无法标记你
-
确保您的服务是可注入的。
标签: javascript angular typescript firebase