本文整理汇总了TypeScript中angularfire2/firestore.AngularFirestore.createId方法的典型用法代码示例。如果您正苦于以下问题:TypeScript AngularFirestore.createId方法的具体用法?TypeScript AngularFirestore.createId怎么用?TypeScript AngularFirestore.createId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angularfire2/firestore.AngularFirestore
的用法示例。
在下文中一共展示了AngularFirestore.createId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: addPrestation
addPrestation(item: Prestation): Promise<any> {
const id = this.afs.createId();
const prestation = { id, ...item };
return this.itemsCollection.doc(id).set(prestation).catch((e) => {
console.log(e);
});
}
示例2: addOrderPrice
addOrderPrice(t: any) {
let id = this.db.createId();
let pastOrder = new PastOrder();
pastOrder.id = "past-order/" + id
pastOrder.orders[t.detail] = parseFloat(parseFloat(t.price + "").toFixed(2))
pastOrder.restaurant = t.description
this.db.collection<PastOrder>("past-order").doc(id).set(JSON.parse(JSON.stringify(pastOrder)));
}
示例3: createItem
private createItem(item: Widget, userId: string): Promise<void> {
//
const doc = this.toFirestoreDoc(item);
const dateNow = Date().toString();
doc.id = this.afs.createId();
const recordToSet: FirestoreDoc = {
...doc,
sysDateCreatedOn: dateNow,
sysDateUpdatedOn: dateNow,
};
return this.firestoreCollection(userId)
.doc(recordToSet.id)
.set(recordToSet);
}
示例4: addWithId
public addWithId(path: string, data: any): Promise<void> {
data.id = this.angularFirestore.createId();
return this.angularFirestore.doc<any>(`${path}/${data.id}`).set(data);
}
示例5: create
create(contact: ContactProfile): Promise<void> {
const id = this.af.createId();
contact._id = id;
const data = JSON.parse(JSON.stringify(contact));
return this.itemsCollection.doc(id).set(data);
}
示例6: getId
getId() {
return this.afs.createId();
}