本文整理匯總了TypeScript中angularfire2/firestore.AngularFirestoreCollection.doc方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript AngularFirestoreCollection.doc方法的具體用法?TypeScript AngularFirestoreCollection.doc怎麽用?TypeScript AngularFirestoreCollection.doc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類angularfire2/firestore.AngularFirestoreCollection
的用法示例。
在下文中一共展示了AngularFirestoreCollection.doc方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: updatePrestation
updatePrestation(item: Prestation, option?: StatePrestation): Promise<any> {
const presta = {...item};
if (option) {
presta.state = option;
}
return this.itemsCollection.doc(item.id).update(presta).catch((e) => {
console.log(e);
});
}
示例3: newCustomer
newCustomer(customer: Customer, id: string){
this.customersCollection.doc(id).set(customer);
}
示例4: removeTodo
removeTodo(id) {
return this.todosCollection.doc(id).delete();
}
示例5: updateTodo
updateTodo(todo: Todo, id: string) {
return this.todosCollection.doc(id).update(todo);
}
示例6: getTodo
getTodo(id) {
return this.todosCollection.doc<Todo>(id).valueChanges();
}
示例7: getHouse
getHouse(id: string) {
return this.housesCollection.doc(`${id}`).valueChanges();
}
示例8: 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);
}
示例9: update
update(contact: ContactProfile) {
const id = contact._id;
contact.modified = Date.now();
const data = JSON.parse(JSON.stringify(contact));
return this.itemsCollection.doc(id).update(data);
}
示例10: update
update(id: string, changes: any) {
return this.itemsCollection.doc(id).update(changes);
}