本文整理汇总了TypeScript中angularfire2/firestore.AngularFirestoreCollection.valueChanges方法的典型用法代码示例。如果您正苦于以下问题:TypeScript AngularFirestoreCollection.valueChanges方法的具体用法?TypeScript AngularFirestoreCollection.valueChanges怎么用?TypeScript AngularFirestoreCollection.valueChanges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angularfire2/firestore.AngularFirestoreCollection
的用法示例。
在下文中一共展示了AngularFirestoreCollection.valueChanges方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: _ConnectToFirebase
_ConnectToFirebase() {
let districtCollectionRef: AngularFirestoreCollection<District> = this.mAngularFirestore.collection("districts", ref => {
return ref.where('province_code', '==', this.mProvince.code);
});
this.mDistricts = districtCollectionRef.valueChanges();
}
示例2: ionViewWillEnter
ionViewWillEnter() {
// var id = this.afAuth.auth.currentUser;
const userId = this.afAuth.auth.currentUser.uid;
// if (auth == auth){
this.itemsCollection = this.afs
.collection(`items`, ref => ref
.where('users.${userId}', '==', true))
.doc(userId)
.collection(`items`); //ref()
// this.itemsCollection = this.afs.collection('items', ref => ref.where('itemid', '==', 'itemid'));
this.items = this.itemsCollection.valueChanges();
// this.afAuth.authState.subscribe((auth) => console.log(auth.uid, this.items));
// }
}
示例3: Chart_client_totalHT
Chart_client_totalHT(): Observable<any> {
return this.itemsCollection.valueChanges().pipe(
map((data) => {
const res = [];
data.forEach(elem => {
elem = new Prestation(elem);
res.push({name : elem.client, value : elem.totalHT()});
// console.log(elem);
});
// console.log(res);
return res;
})
)
}
示例4: constructor
constructor(
private afs: AngularFirestore
) {
this.itemsCollection = afs.collection<Prestation>('prestations');
this.collection = this.itemsCollection.valueChanges().pipe(
map((data) => {
const res: Prestation[] = [];
data.forEach(elem => {
// console.log(elem);
elem = new Prestation(elem);
res.push(elem);
// console.log(elem);
});
return res;
})
);
// this.collection = [
// new Prestation({
// id: 'a1',
// intitule: 'Dev Angular',
// client: 'coderbase',
// lieu: 'Paris',
// date_debut: '2018-11-20T23:00:00.000Z',
// date_fin: '2018-11-21T23:00:00.000Z',
// tjm_ht: 500,
// nb_jours: 2
// }),
// new Prestation({
// id: 'b1',
// intitule: 'Dev Angular',
// client: 'm2i',
// lieu: 'Paris',
// date_debut: '2018-11-20T23:00:00.000Z',
// date_fin: '2018-11-21T23:00:00.000Z',
// tjm_ht: 500,
// nb_jours: 2
// }),
// new Prestation({
// id: 'c1',
// intitule: 'Dev Angular',
// client: 'edugroupe',
// lieu: 'Paris',
// date_debut: '2018-11-20T23:00:00.000Z',
// date_fin: '2018-11-21T23:00:00.000Z',
// tjm_ht: 500,
// nb_jours: 2
// }),
// ];
}
示例5: getReservation
getReservation(id) {
this.reservationsCollection = this.afs.collection(`Houses/${id}/reservation`);
this.reservation = this.reservationsCollection.valueChanges();
return this.reservation;
}
示例6: ngOnInit
ngOnInit() {
this.messages = this.msgRef.valueChanges();
this.scrollToBottom();
}