0
我使用离子V1制作了Android项目。我希望在应用关闭之前让应用发送一些功能Cordova event。我尝试使用暂停发送数据到服务器,但我坚持在app.run()发送数据。这是我在代码app.js如何在离子中包含app.run()中的HTTP请求
.run(function ($ionicPlatform) {
$ionicPlatform.ready(function() {
document.addEventListener("pause", onPause, false);
});
function onPause($http) {
$http.get('https://localhost:88/web.php?tN=off&f12=123456789')
.then(function(response){
console.log(response);
}, function(error){
//there was an error fetching from the server
});
}
});
这错误从调试
Uncaught TypeError: Cannot read property 'get' of undefined
我不知道哪里是什么不对的代码。我用在controller.js
它正常工作,但在app.js
它不起作用。请帮我解决这个问题。由于
控制台日志错误是一件好事,在你的代码的起点分享过 –
加$ HTTP –