Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Probably question, maybe bug XD #1468

Closed
onkelpete opened this issue Nov 6, 2019 · 3 comments
Closed

Probably question, maybe bug XD #1468

onkelpete opened this issue Nov 6, 2019 · 3 comments

Comments

@onkelpete
Copy link

onkelpete commented Nov 6, 2019

I got error while saving data.
this code save the data successfull:

import * as firebase from "nativescript-plugin-firebase/firebase";

@Injectable()
export class MyExampleService {
public create(myObject: any): Promise<any> {
        return firebase.push(`${Path.DB_PATH.question}`, "").then(pushResult => {
            myObject.key = pushResult.key;
            firebase.setValue(`${Path.DB_PATH.question}/${myObject.key}`, JSON.stringify(myObject));
            return myObject;
        });
    }
}

this code dosen't work:

public create(myObject: any): Promise<any> {
        return firebase.push(`${Path.DB_PATH.question}`, myObject).then(pushResult => {
            myObject.key = pushResult.key;
            firebase.setValue(`${Path.DB_PATH.question}/${myObject.key}`, myObject);
            return myObject;
        });
    }

or
still not working...

public create(myObject: any): Promise<any> {
        return firebase.push(`${Path.DB_PATH.question}`, '').then(pushResult => {
            myObject.key = pushResult.key;
            firebase.setValue(`${Path.DB_PATH.question}/${myObject.key}`, myObject);
            return myObject;
        });
    }

JS Stack:
setValueWithCompletionBlock([native code])
at file:///node_modules/nativescript-plugin-firebase/firebase.js:1187:0
at ZoneAwarePromise(file:///node_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:902:0)
at setValue(file:///node_modules/nativescript-plugin-firebase/firebase.js:1185:0)
at file:///src/app/services/my-example.service.ts:54:33

Package.json

"tns-android": {
      "version": "6.1.2"
    },
    "tns-ios": {
      "version": "6.1.1"
    },
"dependencies": {
    "@angular/animations": "8.2.6",
    "@angular/common": "8.2.6",
    "@angular/compiler": "8.2.6",
    "@angular/core": "8.2.6",
    "@angular/forms": "8.2.6",
    "@angular/platform-browser": "8.2.6",
    "@angular/platform-browser-dynamic": "8.2.6",
    "@angular/router": "8.2.6",
    "@nstudio/nativescript-loading-indicator": "^1.0.0",
    "@nstudio/nativescript-snackbar": "1.0.0",
    "nativescript-angular": "8.2.1",
    "nativescript-camera": "^4.5.0",
    "nativescript-datetimepicker": "1.2.1",
    "nativescript-drop-down": "^5.0.4",
    "nativescript-gif": "^4.0.2",
    "nativescript-imagepicker": "^7.1.0",
    "nativescript-ng-shadow": "2.1.0",
    "nativescript-plugin-firebase": "10.1.1",
    "nativescript-theme-core": "1.0.6",
    "reflect-metadata": "0.1.13",
    "rxjs": "6.5.3",
    "tns-core-modules": "6.1.2",
    "zone.js": "0.9.1"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~8.2.0",
    "@ngtools/webpack": "~8.2.0",
    "nativescript-dev-webpack": "~1.2.0",
    "typescript": "~3.5.3"
  },
@EddyVerbruggen
Copy link
Owner

Please share a repo I can clone and run.

@onkelpete
Copy link
Author

Please share a repo I can clone and run.

Already done

@EddyVerbruggen
Copy link
Owner

Let's continue in your repo.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants