1

So far REST API get method working in my local ng serve , but in my device not working.

Android device remote debug showing :URL:'localhost/get/list'

proxy.config.json

"/code":{   
        "target": "http://192.x.x.x:8010",   
        "secure":false,
        "changeOrigin": true,
        "logLevel": "debug"
    },

Serive Get Method:

      this.service.getUrl('/get/list','level=2').subscribe(
        data=>{ //Android Device URL :localhost/get/list not showing proxy.config.url

});

package.json

"start": "ng serve   --proxy-config proxy.conf.json",

Remote Debug Result:**I can't get **_body result like local result , it's seems getting index.html page.

Android Remote DEBUG

Local ng Serve Result: Local

sameer
  • 447
  • 3
  • 12
  • 20

1 Answers1

1

If you are using the emulator and the API is on your local machine, change the IP address in proxy.config.json to 10.0.2.2. Check out How do you connect localhost in the Android emulator?

Diesel
  • 5,099
  • 7
  • 43
  • 81