1
votes

Ionic v4

Items controller: enter image description here

Response in DevTools -> in "Data" I always get data from database - in web application everything works correctly enter image description here

Response from Postman:

enter image description here

Please could anyone explain me what is bad i'm my code?

Ionic info: Ionic:

ionic (Ionic CLI) : 4.8.0 (C:\Users\Admin\AppData\Roaming\npm\node_modules\ionic) Ionic Framework : @ionic/angular 4.0.0-rc.1 @angular-devkit/build-angular : 0.11.4 @angular-devkit/schematics : 7.1.4 @angular/cli : 7.1.4 @ionic/angular-toolkit : 1.2.2

Cordova:

cordova (Cordova CLI) : 8.1.2 ([email protected]) Cordova Platforms : android 7.1.4 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.2, (and 5 other plugins)

System:

NodeJS : v8.11.1 (C:\Program Files\nodejs\node.exe) npm : 6.4.1 OS : Windows 10

EDIT: New response after @N. Tasikj comment: enter image description here

EDIT2: After change Content-Type application/json

Get item-front:enter image description here

Get item-backend:enter image description here

login backend: enter image description here

1
In response from devtools we can see a html code instead of json dataSimon

1 Answers

0
votes

You are requesting

application/x-www-form-urlencoded

so, if you want your response to be JSON change header - Content Type in your controller. Change it with

application/json