本文整理汇总了TypeScript中angularfire2/firestore.AngularFirestoreCollection.add方法的典型用法代码示例。如果您正苦于以下问题:TypeScript AngularFirestoreCollection.add方法的具体用法?TypeScript AngularFirestoreCollection.add怎么用?TypeScript AngularFirestoreCollection.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angularfire2/firestore.AngularFirestoreCollection
的用法示例。
在下文中一共展示了AngularFirestoreCollection.add方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: newOrder
newOrder(order: Order){
this.ordersCollection.add(order)
.then(res =>{
console.log("success order added");
})
.catch(err => {
console.log("error" + err);
})
}
示例2: newPayment
newPayment(payment: Payment){
this.paymentsCollection.add(payment)
.then(res =>{
console.log("success payment added");
})
.catch(err => {
console.log("error" + err);
})
}
示例3: newSession
private async newSession(user: firebase.User) {
const ref: AngularFirestoreCollection<any> = await this.af.collection('sessions')
console.log('user', user)
const data = {
name: user.displayName,
date: new Date(),
uid: user.uid
}
return await ref.add(data)
}
示例4: newInventoryItem
newInventoryItem(inventoryItem: InventoryItem){
this.inventoryItemsCollection.add(inventoryItem);
}
示例5: saveRound
private saveRound(session, round) {
const ref: AngularFirestoreCollection<any> = this.af.collection(`sessions/${session.id}/round`);
return ref.add(round);
}
示例6: newClient
newClient(client: Client){
this.clientsCollection.add(client);
}
示例7: addTodo
addTodo(todo: Todo) {
return this.todosCollection.add(todo);
}
示例8: addHouse
addHouse(house: House) {
this.housesCollection.add(house);
}
示例9: addMsg
addMsg(msg) {
this.messages.add(msg);
}
示例10: save
save(comment: Comment) {
const data = JSON.parse(JSON.stringify(comment));
console.log(data);
return this.itemsCollection.add(data);
}