Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

Controller runs before .run

$
0
0

Hello i have this issue, i declare a localstorage variable like this:

.run(function($ionicPlatform, $rootScope, $localstorage) {
  $ionicPlatform.ready(function() {
    
    $localstorage.setObject('global', {
        urlService: "http://www.url-to-go.com/",
        rangoDistancia:  0.089831
        });


    if (window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
      cordova.plugins.Keyboard.disableScroll(true);

    }
    if (window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleDefault();
    }
  });
})

it supose when first run and when the platform is ready set the variable, then the controller can read the value, but is empty, i need to close the app and open again and then the values are set, please if some one can tell me what i'm doing wrong, thanks.


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>