@rafaelddias wrote:
Hello to everyone,
I'm trying to load a module only when I have an internet connection. The problem is that I dont know how to proceed. The module that I'm trying to load is the ngMap, and here is the code that I am using, but it is not working:angular.module('starter', ['ionic','ngCordova','starter.getters','starter.main','starter.intro']) .run(function($ionicPlatform,$ionicPopup) { $ionicPlatform.ready(function() { if(window.Connection) { if(navigator.connection.type == Connection.NONE) { $ionicPopup.confirm({ title: "Ligação à internet", content: "Por favor ligue-se a internet para fazer uso de todas as funcionalidades." }) .then(function(result) { if(!result) { ionic.Platform.exitApp(); } }); } else { //the module I'm trying to load angular.module('starter', ['ngMap']); // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard // for form inputs) if(window.cordova && window.cordova.plugins.Keyboard) { cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false); } if(window.StatusBar) { // org.apache.cordova.statusbar required StatusBar.styleDefault(); } } } }) })
I tried loading the module in the main module declaration, but it gave me an error saying that it was unable to load the module.
How can I proceed in this case?
Posts: 1
Participants: 1