【发布时间】:2016-05-02 00:42:46
【问题描述】:
我正在使用 firebase 连接 connection test 检测脚本在用户断开连接时显示模式,但由于某种原因,当应用程序加载时它会触发这两种情况,即使它有连接,它也会显示断开连接的模式。我做错了什么。
var firebaseRef = new Firebase(FIREBAE_URL);
firebaseRef.child('.info/connected').on('value', function(connectedSnap) {
if (connectedSnap.val() === true) {
console.log("connected");
} else {
console.log("not connected");
setTimeout(function(){
$ionicPopup.show({
title: 'Network is either down or poor wifi',
template: 'Either pay for some wifi or go to a cafe',
buttons: [{
text: '<b>ok</b>',
type: 'button-positive'
}]
});
}, 8000)
}
});
【问题讨论】:
标签: angularjs ionic-framework firebase firebase-authentication