本文整理匯總了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();
}