如何在Angular中使用HTTPClient模块将文件上载到firebase?

如何在Angular中使用HTTPClient模块将文件上载到firebase?,angular,typescript,firebase,angular-httpclient,angular-http,Angular,Typescript,Firebase,Angular Httpclient,Angular Http,我通过开发一个简单的购物网站克隆web应用程序开始学习Angular,使用firebase作为后端。我使用HTTP请求(get/post/put)检索和修改firebase中的数据 是否有任何方法可以使用HTTP请求将图像上载到firebase存储?如果是这样,请在这些方面给予帮助 fileUploader() { const file = ... // assign the image file here ref.put(file).then(function(snapshot

我通过开发一个简单的购物网站克隆web应用程序开始学习Angular,使用firebase作为后端。我使用HTTP请求(get/post/put)检索和修改firebase中的数据

是否有任何方法可以使用HTTP请求将图像上载到firebase存储?如果是这样,请在这些方面给予帮助

fileUploader() {
    const file = ... // assign the image file here
    ref.put(file).then(function(snapshot) {
        console.log('Uploaded the file!');
    });
}

是的,您可以使用上述方法将文件存储到云存储。

我正在使用firebase提供的rest api,使用以下http请求连接实时数据库:this.httpClient.put('rest api URL'+rowId+'.json',userData)。那么,有没有办法使用这种方法将图像上传到firebase?您无法将文件存储在实时数据库中。您需要使用firebase云存储