Created
September 11, 2015 08:59
-
-
Save zarko-tg/e62eb881cdf86b5c0ac0 to your computer and use it in GitHub Desktop.
Small Ionic http test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ionic Starter App | |
// angular.module is a global place for creating, registering and retrieving Angular modules | |
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html) | |
// the 2nd parameter is an array of 'requires' | |
angular.module('starter', ['ionic']) | |
.run(function($ionicPlatform, $http) { | |
$ionicPlatform.ready(function() { | |
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard | |
// for form inputs) | |
if(window.cordova && window.cordova.plugins.Keyboard) { | |
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); | |
} | |
if(window.StatusBar) { | |
StatusBar.styleDefault(); | |
} | |
// No need for timeout really but just wait 5 second before making the call | |
setTimeout( function () { | |
$http.get('http://httpbin.org/get'). | |
then(function(response) { | |
// this callback will be called asynchronously | |
// when the response is available | |
alert('ok'); | |
}, function(response) { | |
// called asynchronously if an error occurs | |
// or server returns response with an error status. | |
alert('not ok '); | |
console.log( 'response', response ); | |
}); | |
}, 5000 ); | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment