1

This question is IONIC 2 specific - ionic packages and uses angular in it's own way.

ionic 2.2.3

new hello world app

either served or on device

chrome dev tools / debugger

angular.version doesn't work- angular is not defined

Can I / How do I get the angular version number (preferably in the console) ?

6
  • Possible duplicate of How can I check which version of Angular I'm using? Commented May 8, 2017 at 13:29
  • Not a duplicate. This is specific to ionic 2 ( which bundles angular as part of app scaffolding ) . Commented May 8, 2017 at 13:34
  • Do you have access to the project's sourcecode? Commented May 8, 2017 at 13:38
  • Check your package.json the value after @angular/core is your angular version Commented May 8, 2017 at 13:38
  • @Ivaro18 Cheers ! I was looking at the package .json files in the \@angular dirs. They all (including) @angular/core say version 4 which the ionic 3 (RC status) blog says is new to ionic 3 so all clear as mud. Commented May 8, 2017 at 13:43

2 Answers 2

4

The version currently in use of Angular can be found in your package.json file. The value after @angular/core is you angular version (unless you have manually overridden it)

Sign up to request clarification or add additional context in comments.

3 Comments

ah! so that package.json value could be wrong and the build processes might not pick it up meaning I was actually using angular2.x when it says 4 .... ( new to angular and ionic ) . What I want is a way to know with (reasonable) certainty which version is running - I'd prefer to "hear" it from angular (eg. angular.version would have been nice).
It is the angular version you're running. Unless you did something like npm install @angular/[email protected] in which case you will run version 2.0.0
If you didn't do anything like that with version numbers you will have the value in your package.json. Even if you do override it, you should always add a --save flag, this ensures that you can still see it in package.json
1

Angular version is specified in package.json in your project root directory.

Ionic 2.3.0 used Angular 2.4.8: https://github.com/driftyco/ionic/blob/e07aad460d2c3e1c3f3395dd5ecdcfb7d067c72e/package.json#L28

Latest Ionic 3.0.1 uses Angular 4.0.0 be default: https://github.com/driftyco/ionic/blob/0182f070611224a05219e3a8c591173f017cc2b4/package.json#L28

But you can change it to 4.1.0 if wish.

I advise you to upgrade to latest Ionic version as there are quite a lot of changes & bug fixes.

5 Comments

2.2.3 is the latest official release. 3 is still RC status. I did not change it so it appears 2.2.3 is using angular 4 ( according to the package.json file)
It is Ionic CLI v3in beta. The Ionic Framework v3.0.1 is release version. 3.1.1 is in beta.
Yes - I've just learned "ionic" is the CLI. "ionic-angular" is the framework. So "ionic X.x " actually refers to "ionic-angular X.x" and "ionic X.x" refers to the CLI. Why would you do that ??????
Because they don't depend on each other much.
No. The sensible thing to do would have been (if they wanted to talk about it in those terms) to have you install "ionic-cli" and then have the cli install "ionic" as the framework. This way there wouldn't be the confusion that you installed "ionic" which is not "ionic" when they're talking about it.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.