首先,我要说我正在学习Angular.也许答案太明显但我看不到它.我在网上搜索了类似问题的回复,但我没有发现任何对我有用的问题.
我制作了一个Angular Template Driven Form,用于在Firebase Cloud Firestore数据库中存储产品.我创建了一个名为"产品"的模型
product.ts
export class Product {
constructor(
public code: string,
public desc: string,
public stock: number,
public price: number,
public off: number,
public details?: string
) {}
Run Code Online (Sandbox Code Playgroud)
}
然后,我有product.component.ts
import { Component } from '@angular/core';
import { Product } from './product';
import { AngularFirestore, AngularFirestoreCollection } from 'angularfire2/firestore';
import { Observable } from 'rxjs/Observable';
@Component({
selector: 'app-admin-product',
templateUrl: 'product.component.html'
})
export class AdminProductComponent {
model = new Product('', '', 0, 0, 0);
successMsg …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 Firebase Cloud Functions 上部署一个简单的函数,但控制台记录了一个错误,我无法弄清楚在哪里
我的 index.js:
const functions = require('firebase-functions');
const admin = require('firebase-admin')
admin.initializeApp()
exports.updateAccount = functions.firestore.document('accounts/{client_id}/movements').onWrite(change => {
const document = change.after.exists ? change.after.data() : null
console.log(document)
})
Run Code Online (Sandbox Code Playgroud)
控制台说:
? functions: failed to create function updateAccount
HTTP Error: 400, The request has errors
Functions deploy had errors with the following functions:
updateAccount
To try redeploying those functions, run:
firebase deploy --only functions:updateAccount
To continue deploying other features (such as database), run:
firebase deploy --except functions
Error: Functions …Run Code Online (Sandbox Code Playgroud)