我是ionic1框架的新手,并且在sidemenu离子应用上工作。我正在使用cordova local notification
其工作正常,但我需要在$ionicPlatform.ready
的特定条件下发送通知。对于条件,我使用$http
从webservice获取数据,但不幸的是,我无法从$http
中检索数据。
$ionicPlatform.ready(function() {
var conditionvariable="true";
$http.get("http://www.example.com/abc.php").then(function(response)
{
var test = response.data[0];
if(test.result=='test')
{
conditionvariable="false";
}
});
alert(conditionvariable);
})
我无法从功能$http.get
函数中获取数据。如果我试图警告它出警报功能undefined
请帮助如何获取数据。
这已被问及(并回答)至少在单独的Stackoverflow上千次。 – jcaron
[我如何从异步调用返回响应?](http://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-call) – jcaron