Can't connect to backend when using "ionic run"


I have a working backend online. I can access it on my device.

In development mode, I use a proxy to avoid CORS.
When I run “ionic run”, I remove it.
This part of code:

var checkInternetConnection = function () {
$ionicPlatform.ready(function () {
if (window.Connection) {
if (navigator.connection.type == Connection.NONE) {
title: “Internet Disconnected”,
template: “The internet is disconnected on your device.”
$http.get(“”).error(function (errors) {
title: “Connection error”,
template: errors

(sorry for the bad indentation)

Doesn’t give me the “Internet Disconnected” popup, but the “Connection error” one with, as a template, nothing… (this was for debugging, but “nothing” doesn’t help me)
Is it a CORS problem? I have read CORS doesn’t appear when using “ionic run” without live reload.
It’s not a connection error.

Well, I don’t know, please can someone help me?

PS: I’m running on android 5.0.1, the last one I suppose…

Same problem.

The Connection javascript file from network-information plugin no longer gets loaded in correctly.

I “fixed” it by adding:

// FIXME: we shouldn't need to do this... if (!Connection) { console.warn("'Connection' object not found!"); var Connection = { UNKNOWN: "unknown", ETHERNET: "ethernet", WIFI: "wifi", CELL_2G: "2g", CELL_3G: "3g", CELL_4G: "4g", CELL: "cellular", NONE: "none" }; }

I do not know of a more permanent solution.

Sorry, maybe I didn’t explain well. The problem is not with the Connection object, but the http request, which fails for an unknown reason.

Was not clear due to the poor formatting.

Just to check though:

if (window.Connection) { //... } else { console.error("No Connection Object"); }

I understand…

This part:

if (window.Connection) {
…if (navigator.connection.type == Connection.NONE) {
…title: “Internet Disconnected”,
…template: “The internet is disconnected on your device.”

This actually popup the alert when I turn off Internet on my device. And not when it’s on.
So Connection is fine.

ok got it… Stupid error. I POSTed to /token/ instead of http://…/token