Get attribute value from config.xml


Hello community,
As I want to introduce API versioning I would like to set an attribute in config.xml like the existing “version” and then parse it in Ionic:

.config(function ($httpProvider) {
    $httpProvider.defaults.headers.common['api_version'] = 1;

Is it possible in a simple way?

Thank you :grin:


Are to trying to access the config.xml file that Cordova uses to generate the native apps? If so, that file is not available to be read once the apps are compiled


Not exactly access it directly from the config.xml, instead I would like to grab that value (maybe at compilation time ?) and then use it in Angular .config()


Then look at creating a Cordova Hook to do this. There are many events that you can hook a custom script into and do this. Look on the Cordova website for more information.


I thought that way, thanks!


I’ve just found a solution for anyone interested: