Help App Version

I’m no expert.
Sorry if the question is insignificant, but as I’m learning to ask.

How to use native ionic 2, in the following situation:
How to print in html(AppVersion.getVersionCode();)?
What is the process to get the result? Will the constructor? Could you give me a simple example of use? The way that the documentation I could not understand.

in .js
import {AppVersion} from ‘ionic-native’;


in .html
<ion-card-content> {{VERSAO}} </ion-card-content>

I have already installed the plugin in my project.
$ ionic plugin add cordova-plugin-app-version

I think all those functions return a promise rather than a value. Try something like this in your constructor:

this.versionNumber = 'unknown';

if('cordova')) {
    AppVersion.getVersionNumber().then((s) => {
    this.versionNumber = s;

and then use


in your html template.

The “” wrapper is to avoid errors if you’re testing in a browser.

1 Like

Thank you fuffenz, I will test .
I think the documentation lack a better example. Especially for those who are learning .

hey i tried above code but i getting problem …in my case version get but when i assign version to variable didn’t work

AppVersion.getVersionNumber().then((s) => {
this.fetchData = s;

in above code ‘s’ value print proepr but when i print this.fetchData…print undefined

Might be a scope problem, are you sure “this” is referring to the correct namespace?

this thread is 2 years old

My bad, I only saw „3 month“ on top of the comment and misstook it for the age.