How can I capture config.xml version and display in my app?
I’m trying to use $http.get to get the and attr version and then display in ionic app but I cannot seem to get it to work.
How can I capture config.xml version and display in my app?
I’m trying to use $http.get to get the and attr version and then display in ionic app but I cannot seem to get it to work.
Rather than doing it at runtime, I would do it at build time like Generator-M does it in their configuring.js gulp task.
You could then parse config.xml and create angular constants for the values you’re interested in.
@gmarziou Thanks for the reply I’ll take a look at that.
use the appVersionPlugin its available in ngCordova too
@djett Thanks. I’ll take a look. I’m still having issues getting this to work. If I understand correctly since this is a cordova plugin there is no way for me to test this in the browser right? I can only test it in a Build/Emulator.
When I inject $cordovaAppVersion into my controller It crashes in the browser with error…
So I set up the ngCordova plugin and everything seems to be good. Except for when I run a build i’m not getting the App version I’m only seeing my function code.
Here’s the code in my controller
vm.version = function() {
$ionicPlatform.ready(function() {
$cordovaAppVersion.getAppVersion().then(function (version) {
var appVersion = version;
return appVersion;
});
});
};
Using ng-bind=“ctrl.version”
@mmarrow your version function wont work like that. Instead it would be better to set the scope variable when the app version resolves… like the following controller code (additonal note: 4 spaces will indent your code)
//code that goes inside your controller function
$scope.version = null;
$ionicPlatform.ready(function() {
$cordovaAppVersion.getAppVersion().then(function (version) {
$scope.version = version;
});
});
//html code
<div ng-bind="version"></div>
Hi I hv tried with same code but i am not getting version picked from config.xml. Please suggest what to do.