42

I'm trying to buy a angular 5 template online so I just want to confirm for angular version. I have check This question of Angular :-

How can I check which version of Angular I'm using?

But here in this question app version is shown in below image which is captured from development tool,

ng-version is in app tag.

enter image description here

But in the template which I'm trying to purchase has following structure.

ng-version is in body tag.

enter image description here

So, Just for reconfirm I just installed Angular 5. Here in newly installed application they show,

ng-version is in app-root.

enter image description here

That template has other files like,

<script type="text/javascript" src="inline.bundle.js"></script>
<script type="text/javascript" src="polyfills.bundle.js"></script>
<script type="text/javascript" src="styles.bundle.js"></script>
<script type="text/javascript" src="vendor.bundle.js"></script>
<script type="text/javascript" src="main.bundle.js">

I have also Tried with angular.version but it doesn't work for me.

So, it is confirmed that they are using Angular App not other thing but I'm confused about it's Angular-2,4 or 5.

Is there any otherway we can figure it that which version it's running ?

2

3 Answers 3

78

Using the ng-version attribute is the correct way to identify the Angular version number. if you want more confirmation you can execute in console:

getAllAngularRootElements();

which will show you Angular elements. Or more accurately

 getAllAngularRootElements()[0].attributes["ng-version"];
9
  • Hey thank you for your reply But It shows getAllAngularRootElements() is not defined in browser's developement console.
    – Bhavin
    Feb 16, 2018 at 17:22
  • 2
    getAllAngularRootElements was implemented back in beta.8 of Angular 2, so it should be known.
    – Kyler Love
    Feb 16, 2018 at 17:31
  • It works in Angular 6, but doesn't work in Angular 7. verify with these websites -> madewithangular.com/categories/angular Jul 3, 2019 at 13:54
  • 3
    Some of those are not Angular applications. For the ones that are, it is still working. ng-version="7.2.8"
    – Kyler Love
    Jul 3, 2019 at 15:21
  • @naXa As KylerLove suggests, some of the websites featured on that page are not using Angular or AngularJs anymore.
    – MÇT
    Jul 3, 2019 at 20:46
14

Simplest way is to Hit F12 on browser and in the console drawer type -

angular.version

and you will see the version. You can also do angular.version.full and this gives something like this "1.6.6"

0
2

Due to Kyler's Help I figure it out that this template is not built with Angular-5. It's lower than the Angular 2 version beta.8 (I don't know the exact version but but it's not Angular-5).

They are showing that they are made with Angular-5 but it's not Because it show me the error.

Uncaught ReferenceError: getAllAngularRootElements is not defined

Because with reference to this git's issue :- https://github.com/rangle/augury/issues/245

I figure it out that getAllAngularRootElements() will work with Angular2 version beta.8 and greater. So, it means that it's lower than the Angular 2 version beta.8.

And I have tried this function with my Angular-5 application and that function works.

enter image description here

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.