$ionicplatform shared data

hi everyone,

i have some doubt about this “main” variable. standing to my actual knowledge $ionicplatform is the main function. i have a plugin that read the imei, i called this plugin inside this function in this way :

.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
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();
}
window.plugins.imeiplugin.getImei(callback);
function callback(imei){
document.querySelector(’.imei’).innerHTML=imei;
return imei;
}
});
})

now it would be nice to access the variable imei, inside my app, how i can do this? simply writing “return imei” does not works.i thought that i may create a service that will handle all “device” stuff ( id, camera, geolocation) something like this may works?

angular.module('starter.device_services.js',[]);
.factory('IMEI', function($ionicPlatform){
});

passing the $ionicplatform to the service?

thanks in advance,

davide
`

Its always better practice to create a separate factory for such actions. Or try using $window.localStorage.

you mean in this way?..in the doc pages i’ve seen something about the state to pass data whitin the app

Please refer here http://learn.ionicframework.com/formulas/sharing-data-between-views/

:no_mouth: