Posting to backend by selecting an id in dropdown


#1

I have a question how can I post from two entities. Let says I have I created cars post now I want to use the cars post as a drop down and then post report by referencing the car id from my database in ionic 2.

my service

global packages:

@ionic/cli-utils : 1.4.0
Ionic CLI        : 3.4.0

local packages:

@ionic/app-scripts              : 1.3.12
@ionic/cli-plugin-ionic-angular : 1.3.1
Ionic Framework                 : ionic-angular 3.5.0

System:

Node       : v6.9.1
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 4.2.0

#2

Get rid of all uses of any in your code, and explicitly declare all function parameters and return values with types and you will discover the proximate problem, which is that you are trying to post a FormGroup instead of its value.

Additionally, stop explicitly instantiating Promises. You are not propagating errors correctly. Http gives you perfectly good Observables. Just use those.


#3

I was using Observables but after many trial and error, I changed them to promise to see if this would fix my issue, do not mind being explicit by saying stop explicitly instantiating