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) ?

Bob
  • 1,589
  • 17
  • 25
  • Possible duplicate of [How can I check which version of Angular I'm using?](http://stackoverflow.com/questions/16017699/how-can-i-check-which-version-of-angular-im-using) – mxr7350 May 08 '17 at 13:29
  • Not a duplicate. This is specific to ionic 2 ( which bundles angular as part of app scaffolding ) . – Bob May 08 '17 at 13:34
  • Do you have access to the project's sourcecode? – Flurin May 08 '17 at 13:38
  • Check your `package.json` the value after `@angular/core` is your angular version – Ivar Reukers May 08 '17 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. – Bob May 08 '17 at 13:43
  • No problem :) I'll submit it as an answer so this question can be closed. – Ivar Reukers May 08 '17 at 13:44

2 Answers2

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)

Ivar Reukers
  • 7,560
  • 9
  • 56
  • 99
  • 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). – Bob May 08 '17 at 13:54
  • It is the angular version you're running. Unless you did something like `npm install @angular/core@2.0.0` in which case you will run version `2.0.0` – Ivar Reukers May 08 '17 at 13:56
  • 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` – Ivar Reukers May 08 '17 at 13:58
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.

Alexander Trakhimenok
  • 6,019
  • 2
  • 27
  • 52
  • 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) – Bob May 08 '17 at 13:50
  • It is Ionic CLI v3in beta. The Ionic Framework v3.0.1 is release version. 3.1.1 is in beta. – Alexander Trakhimenok May 08 '17 at 14:20
  • 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 ?????? – Bob May 08 '17 at 15:17
  • Because they don't depend on each other much. – Alexander Trakhimenok May 08 '17 at 15:49
  • 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. – Bob May 08 '17 at 16:39