Last active
June 16, 2020 01:58
-
-
Save wedwin53/da312c495ae1868e46edc7292b0f0271 to your computer and use it in GitHub Desktop.
Firebase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#usuarios: al objeto en firebase | |
firebase.database().ref('usuarios').set('objeto con valores') | |
#otra manera el child es el objeto hijo | |
firebase.database().ref('usuarios').child('1').set('objeto con valores') | |
#manejo de errores | |
firebase.database().ref('usuarios') | |
.child('1') | |
.set('objeto con valores', fuction(error){ | |
//manejo del error | |
console.log(error) | |
}) | |
#consulta de elementos, value el obligatorio | |
firebase.database().ref('usuarios') | |
.child('1') //el uno es un ejm como referencia del objeto hijo 1 | |
.once('value', function(snaptshot){ | |
//manejar los datos. | |
console.log(snaptshot.val()); | |
}) | |
#obtener el id autogenerado por firebase | |
this.id = firebase.database().ref('/users').push().key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment