Hi, I’m new at ionic and angularjs and I really need to set a variable/array inside $ionicPlatform.ready(function() {
in app.js and be able to access it inside my controller. Just this.
I’ve tried $rootScope but it returns undefined.
I know It’s very simple problem but it’s hard to google it.
I’m posting this here because I went through inumerous topics on this forum as well at stackoverflow.com
Any help will be welcome
Does this* gives you “undefined”?
app.run(function($ionicPlatform, $rootScope){
$ionicPlatform.ready(function() {
console.log($rootScope); // *
});
});
1 Like
sigh …it’s working now. As I said I’m a noob on this area. I was refreshing the page on the browser instead of going through the whole process of initializing the app.
$rootScope works, thanks for replying @joseadrian
Hello,
I face same problem. Have anyone idea?
Thanks David
declare $rootScope service inside run(function($rootScope){}) instead of declaring in $ionicPlatform.ready(function($rootScope) {})