Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How can i send data to firebase #3140

Unanswered
oppourtunity asked this question in Q&A
Discussion options

I have been trying to send data from my angular code to firebase, but all the tutorial uses AngularFireStore which is no more available

You must be logged in to vote

Replies: 1 comment

Comment options

You can use AngularFireDatabase . Please check the code snippet below:

import { Component } from '@angular/core';
import { AngularFireDatabase } from '@angular/fire/database';
[...]
constructor(private db: AngularFireDatabase) {}
[...]
saveData(user: User) {
 this.db.object('users/' + user.email).set(user)
 .then(_ => console.log('Data saved successfully!'))
 .catch(error => console.error('Error saving data:', error));
}

The demo User interface is:

interface User {
 name: string;
 email: string;
 phone: string;
}
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /