@tomjaihk wrote:
I use FirebaseX plugin and its method
fetchDocumentInFirestoreCollection
to access a document from my Firebase database (the document does exist). It successfully passes the success callback function but I am never able to access the document object. I do not know how to do. Here are my two used approaches to access:await this.firebase.fetchDocumentInFirestoreCollection( someDocID, 'someCollection', () => { console.log('fetchFirestoreCollection successfully'); // this can be printed }, error => { console.error('error in fetchFirestoreCollection', error); } ).then( doc => { // Not enter this block ever console.log(doc); } );
// doc is null all the way const doc = await this.firebase.fetchDocumentInFirestoreCollection( someDocID, 'someCollection', () => { console.log('fetchFirestoreCollection successfully'); // this can be printed }, error => { console.error('error in fetchFirestoreCollection', error); } );
But all of these failed to access the returned document. How should I do?
ionic info:
Ionic: Ionic CLI : 5.4.16 Ionic Framework : @ionic/angular 5.1.0 @angular-devkit/build-angular : 0.901.4 @angular-devkit/schematics : 9.1.4 @angular/cli : 9.1.4 @ionic/angular-toolkit : 2.2.0 Cordova: Cordova CLI : 9.0.0 (cordova-lib@9.0.1) Cordova Platforms : android 8.1.0 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 6 other plugins)
cordova plugin:
cordova-plugin-advanced-http 2.4.1 "Advanced HTTP plugin" cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx" cordova-plugin-androidx-adapter 1.1.0 "cordova-plugin-androidx-adapter" cordova-plugin-device 2.0.2 "Device" cordova-plugin-enable-multidex 0.2.0 "Enable Multidex" cordova-plugin-file 6.0.2 "File" cordova-plugin-firebase-authentication 3.3.0 "cordova-plugin-firebase-authentication" cordova-plugin-firebasex 9.1.1 "Google Firebase Plugin" cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard" cordova-plugin-ionic-webview 4.2.1 "cordova-plugin-ionic-webview" cordova-plugin-splashscreen 5.0.2 "Splashscreen" cordova-plugin-statusbar 2.4.2 "StatusBar" cordova-plugin-whitelist 1.3.3 "Whitelist" cordova-sqlite-storage 5.0.0 "Cordova sqlite storage plugin - cordova-sqlite-storage plugin version" cordova-support-android-plugin 1.0.2 "cordova-support-android-plugin" cordova-support-google-services 1.4.0 "cordova-support-google-services"
Posts: 1
Participants: 1