这是HTTP请求的示例:
$http.get(config.domain + '/forums_index.xml').then (data) ->
...
.catch (err) ->
console.log 'Huh ho, ' + err
还有一个像这样的拦截器:
$httpProvider.defaults.headers.common['Authorization'] = "Basic YXBwX2FuZF9tczpOESFtVlI0Yw=="
然后我运行ionic run android
,它运行应用程序,但它继续加载和加载。
$ adb logcat CordovaLog:D *:S
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
I/CordovaLog(17151): Changing log level to DEBUG(3)
I/CordovaLog(17151): Found start page location: index.html
I/CordovaLog(17151): Changing log level to DEBUG(3)
I/CordovaLog(17151): Found start page location: index.html
D/CordovaLog(17151): file:///android_asset/www/js/application.js: Line 3 : Running Application...
D/CordovaLog(17151): file:///android_asset/www/js/application.js: Line 19 : Run fired!
D/CordovaLog(17151): file:///android_asset/www/js/application.js: Line 324 : Hey!
D/CordovaLog(17151): file:///android_asset/www/cordova.js: Line 1154 : deviceready has not fired after 5 seconds.
D/CordovaLog(17151): file:///android_asset/www/cordova.js: Line 1147 : Channel not fired: onPluginsReady
D/CordovaLog(17151): file:///android_asset/www/cordova.js: Line 1147 : Channel not fired: onCordovaReady
D/CordovaLog(17151): file:///android_asset/www/js/application.js: Line 326 : Getting list
D/CordovaLog(17151): file:///android_asset/www/js/application.js: Line 336 : Huh ho, Error: The http request failed
Here是完整的来源(可能会发生一些变化)