离子项目不使用web api在真实设备上工作 [英] Ionic project not working on real device using web api

查看:153
本文介绍了离子项目不使用web api在真实设备上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Ionic和Web Api为Android开发一个移动应用程序。

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.

在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文件

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.

推荐答案

如果您只在Android设备上工作,我会怀疑你正在使用Windows。如果是这种情况,那么当您在设备中运行项目时,控制台应该正常工作。如果它没有显示任何错误,则代码中存在逻辑错误。但作为建议,请对此类案例使用 console.log

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.

这篇关于离子项目不使用web api在真实设备上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆