Ionic app needs to hit server not localhost to login and to test on device <p>I need to test my ionic app on a device and I can't log in. </p> <p>I am using ionic view. <a href="http://view.ionic.io/" rel="nofollow">http://view.ionic.io/</a></p> <p>I can login with my app on the browser and on the emulator. I ran <code>ionic upload</code> and my app is now available to view on the app BUT I can't login. I get the alert messages I set up, "Invalid Credentials".</p> <p>I think the reason is because my API call to login is to the local server.</p> <p><code>Route::get('/api/login/{username}/{password}', 'ApiV2Controller@login_user_or_admin');</code></p> <p><strong>and on the browser...</strong> </p> <p><code>http://localhost/api/login/username/userpassword</code></p> <p><strong>and on my Ionic app this is what the $http get looks like..</strong></p> <pre><code>self.login = function(userLogin, userPw) { var deferred = $q.defer(); $http.get("http://localhost/api/login" + "/" + userLogin + "/" + userPw) .success(function(result) { console.log(result); if (!result.result) { deferred.resolve(false); return false; } UserService.save(result.data); console.log("Login Credentials Submitted Succesfully!"); deferred.resolve(true); return true; }).error(function(data) { alert('Something went wrong'); deferred.resolve(data); }) return deferred.promise; }; //login() </code></pre> <p>I think that's the code in need of updates or what I need to reference so that someone can help me out.</p> <p>How do I approach this issue? What gets fixed first? The route in the API from local host to the actual website address?</p> <p>I would appreciate some pointers as to what I need to know or how to approach this issue and perhaps what needs to be added or refactored. </p> <p>P.S. could this be related to my issue? <a href="http://blog.ionic.io/handling-cors-issues-in-ionic/" rel="nofollow">http://blog.ionic.io/handling-cors-issues-in-ionic/</a></p>