-
Notifications
You must be signed in to change notification settings - Fork 2.2k
How can i send data to firebase #3140
Unanswered
oppourtunity
asked this question in
Q&A
-
I have been trying to send data from my angular code to firebase, but all the tutorial uses AngularFireStore which is no more available
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
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;
}
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment