Ionic project not working on real device using web

2019-09-11 00:13发布

问题:

I am developing an mobile application for android using Ionic and Web Api.

The application working fine when I run this app on the browser emulator but when I trying to deploy on real device it gives me an error login failed.

In app.js

angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', 'services.hub', 'ngStorage', 'angularUUID2', 'ui.bootstrap', 'roy.signalr-hub','angularMoment'])
    .constant('/api', {
        url: 'http://ipAddress/api'
    })

ionic.project file

{
  "name": "ChatApp",
  "app_id": "",
 "proxies": [
  {
    "path": "/api",
    "proxyUrl": "http://ipAddress/api"
  }
  ]
}

Having an login screen click on login should be happen. I am not able to debug the code using real device also.

回答1:

If you are working only on Android Device, I will suspect you are working on a Windows. If that's the case, then when you run the project in your device, the console should be working. If it does not show you any error, then there's a logic error in the code. But as a suggestion, use console.log on cases like this one.



回答2:

May be you can use console.log() or 'ionic alert()'.