Check Internet connection app hangout


#1

Hello Sir,
When I disconnect wi-fi after enter my app, it hangout. It is not working and it does not work . It is happened only when i checked internet every server action. Please help me…

I hvae used bellow code:
$scope.doSubmit= function(sa) {
if(navigator.connection.type == Connection.NONE){
$ionicPopup.confirm({
title: “Internet Disconnected”,
content: “The internet is disconnected on your device. Please Connect Internet”
})
}else {
//Server End code
}


#2

You can use navigator.onLine, which will give a boolean value depending on, whether the device is connected to the internet or not.