Advertisement
Guest User

Untitled

a guest
Aug 24th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. .factory("Network", ['errorModule','$state','$ionicPopup',function(errorModule,$state,$ionicPopup) {
  2.  
  3. return{
  4. isOnline : function(throwErr){
  5. var online = navigator.onLine;
  6. if(!online&&throwErr){
  7. // errorModule.throwException(100,"No network connection");
  8. ionicAlert($ionicPopup,'',"No network connection");
  9. }
  10. return online;
  11. }
  12. }
  13. }
  14. ])
  15.  
  16. if(navigator.onLine){
  17. calldataFetchFunction();
  18. }else{
  19. var alertPopup = $ionicPopup.alert({
  20. template: 'no internet connection',
  21. buttons: [{
  22. text:'Ok',
  23. onTap: function(e) {
  24. calldataFetchFunction();
  25. }
  26.  
  27. }]
  28. });
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement