$http always calls .error when using -l -c

I run

$ ionic run android -l -c

When my code uses $http it always calls .error, never .success.

Dropping the -l and -c resolves the issue, but obviously I then lose the benefits of live reload and console logs.

Exactly the same problem. $http calls work using

$ ionic run ios 

but calls error with

$ ionic run ios -l -c

Did you every find answer?

are you making cross domain requests? If so you will need to proxy an host other than localhost in the ionic.project file as described in the ionic blog related to CORS issues. If you are in fact making cross domain requests I can dig up the blog and point you to it

Yes - I am, i found the answer late last night in this thread: https://github.com/driftyco/ionic-cli/issues/89

And you’re right, the solution can be inferred is here: https://github.com/driftyco/ionic-cli#advanced-serve-options

But it makes no reference to livereload breaking cors in emulated apps.

This is what I was referring to @larpo . This will explain the issue and help you get past the CORS issue. here

1 Like

OK - well now I feel silly. Thanks for the link. That explains everything

1 Like