I am using cordova-plugin-device, which creates a global variable called device after device is ready. It works fine. But I am wondering how the plugin creates the global variable. I tried to bind $rootScope.device to UI and it shows me nothing, I know another way to create a global variable is use angular value recipe. But all explanations I found all creating global variable at the initial stage, by explicitly state a new variable in the module definition file. I checked cordova plugin source code, but didn’t see any kind of statement like this. Actually my problem is nothing to do with the plugin, just curious about how plugin creates global variable.