Jak mogę sprawdzić, której wersji Angular używam?

Jak mogę stwierdzić, której wersji Angular używam?

Próbowałem:

angular --version
angular --v
angular -version
angular -v

Ale get -bash: angular: command not found

Wiem po {[2] } że używam 0.9.6

Ale jak uzyskać wersję angularjs?

Author: Double Expresso, 2013-04-15

28 answers

Edit: Kiedy ta odpowiedź została napisana, był tylko AngularJS 1.X. poszukaj w odpowiedziach poniżej wersji kątowych > = 2.

AngularJS nie posiada narzędzia wiersza poleceń.

Możesz pobrać Numer wersji z samego pliku JavaScript.

Nagłówek bieżącego angular.js:

/**
 * @license AngularJS v1.0.6
 * (c) 2010-2012 Google, Inc. http://angularjs.org
 * License: MIT
 */
 220
Author: TheHippo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2019-04-02 12:26:11

Dla kątowej 1 lub 2 (ale nie dla kątowej 4+):

Możesz również otworzyć konsolę za pomocą narzędzi programistycznych dowolnej przeglądarki i wpisać angular.version, aby uzyskać dostęp do obiektu Javascript, który posiada wersję kątową.

Bardzo przydatne, gdy skrypt jest minifigurowany Bez komentarza nagłówka.

 307
Author: lolski,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-07-03 15:02:35

Dla Angular 2+, w każdej nowoczesnej przeglądarce posiadającej narzędzia programistyczne (F12) można sprawdzić znacznik aplikacji najwyższego poziomu.

Dla Internet Explorer 11 lub Edge można znaleźć informacje TUTAJ :Numer wersji kątowej

Działa na Angular 2+ Przeglądarka Chrome

Tutaj wpisz opis obrazka

Firefox firebug

Tutaj wpisz opis obrazka

 176
Author: Tony Dong,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-07-03 17:31:32

Jeśli używasz angular-cli, możesz to łatwo sprawdzić wpisując

ng -v

Lub {[3] } w Angular 8, W terminalu lub Bash. Uwaga: Uruchom polecenie w katalogu projektu.

Powinieneś dostać coś takiego:

angular-cli: 1.0.0-beta.24
node: 7.4.0
os: darwin x64
@angular/common: 2.4.3
@angular/compiler: 2.4.3
@angular/core: 2.4.3
@angular/forms: 2.4.3
@angular/http: 2.4.3
@angular/platform-browser: 2.4.3
@angular/platform-browser-dynamic: 2.4.3
@angular/router: 3.4.3
@angular/compiler-cli: 2.4.3
 113
Author: István,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2019-06-20 19:26:39

W konsoli deweloperskiej przeglądarki (naciśnij klawisz F12, aby ją otworzyć), możesz wpisać następujący tekst:

angular.version.full

Da ci pełną wersję, np. (w zależności od bieżącej wersji). [Faktycznie otrzymuje full właściwość angular.version obiektu.]

"1.4.3"

Więc, aby zobaczyć cały obiekt, jeśli wpiszesz

angular.version

Wyświetli Ci obiekt full version zawierający informacje o wersji, takie jak full, major, minor, a także nazwę kodową, np.

Object {full: "1.4.3", major: 1, minor: 4, dot: 3, codeName: "foam-acceleration"}
 75
Author: Suman Barick,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-06-21 17:49:41

Możesz również sprawdzić swoją paczkę.json :

"dependencies": {
    "@angular/common": "^5.0.0",
    "@angular/compiler": "^5.0.0",
    "@angular/core": "^5.0.0",
    "@angular/forms": "^5.0.0",
    "@angular/http": "^5.0.0",
    "@angular/platform-browser": "^5.0.0",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.0.0",
  }

(the caret ^ zaktualizuje Cię do najnowszej wersji głównej (pierwszy numer). ^4.3.0 będzie pasować do każdego wydania 4.x.x łącznie z 4.4.0, ale wstrzyma się z 5.0.0. Tylda ~ pasuje do najnowszej wersji podrzędnej (numer środkowy). ~4.3.0 będzie pasować do wszystkich wersji 4.3.x, ale będzie brakować 4.4.0.)

 39
Author: Leo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-11-05 18:38:08

Teraz jest ng-v

Jeśli używasz angular cli, możesz sprawdzić użycie

ng --version

Teraz jest ng-v

Możesz też zameldować się w Pakage.plik json
 "dependencies": {
    "@angular/animations": "^4.0.0",
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "angular-in-memory-web-api": "^0.3.2",
    "core-js": "^2.4.1",
    "rxjs": "^5.1.0",
    "zone.js": "^0.8.4"
  },
 25
Author: Sagar Jethi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-11-23 11:48:08

Istnieje wiele sposobów, można sprawdzić wersję kątową tylko pent comand prompt (dla windows) I type

1. ng version
2. ng v
3. ng -v

sprawdź wersję kątową za pomocą linii comand

4. You can pakage.json file

sprawdź wersję kątową na pakage.plik json

5.You can check in browser by presing F12 then goto elements tab

sprawdź wersję kątową w przeglądarce

Pełne zrozumienie subversion o (x. x. x) patrz dokumentacja kątowa angularJS i kątowa 2+

 24
Author: Srikrushna,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-08-08 03:32:33

Do Angular 4 Wiele opcji już nie działa. Aktualizacja lipiec 2017 dwie możliwości:

1) najprostszym jest otwarcie paczki.json naszego projektu i sprawdzić używane wersje, wśród nich jedną z Angular.

Tutaj wpisz opis obrazka

2) Po wykonaniu ng serve otwieramy Inspektora elementów explorer, którego używamy i możemy obserwować wersję jak w poniższy obrazek.

Tutaj wpisz opis obrazka

 14
Author: Hugo L.M,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-07-24 12:21:25

Innym sposobem byłoby importowanie VERSION stała z @angular/core, a następnie zrzut do konsoli z:

console.log(VERSION.full); //5.2.11

Działa w:

Nie jestem pewien co do kątów 2 i 3. (gdyby ktoś mógł to przetestować; strony nie są dostępne)

Dla AngularJS 1.x użycie angular.version:

console.log(angular.version); //1.7.4
 11
Author: erikvimz,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2019-06-11 10:02:46

Jeśli używasz angular-cli, po prostu użyj polecenia:

ng v
 8
Author: Mwiza,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2019-10-18 15:33:14

Po prostu uruchom ng v w Komendzie

Otrzymasz wynik jak

Angular CLI: 7.3.9
Node: 12.11.0
OS: win32 x64
Angular: 7.2.15
... common, compiler, compiler-cli, core, f
... language-service, platform-browser, pla
... router

Package                           Version
-------------------------------------------
@angular-devkit/architect         0.13.9
@angular-devkit/build-angular     0.13.9
@angular-devkit/build-optimizer   0.13.9
@angular-devkit/build-webpack     0.13.9
@angular-devkit/core              7.3.9
@angular-devkit/schematics        7.3.9
@angular/cli                      7.3.9
@ngtools/webpack                  7.3.9
@schematics/angular               8.0.0
@schematics/update                0.13.9
rxjs                              6.5.3
typescript                        3.1.6
webpack                           4.29.0
 8
Author: Pullat Junaid,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2019-10-29 12:05:11

Attention : The following tylko sprawdza wersję Angular-CLI!!!:

Oba polecenia działają:

ng -v

Lub

ng v

Tutaj wpisz opis obrazka

 6
Author: Legends,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-10-18 15:55:29

For angular 4 + use,

  • wersja ng
  • ng v

Uwaga ng-V opcja nie działa w Angular 7+.

 6
Author: javapedia.net,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-12-30 18:41:27

Dla kątowej 1 lub 2 (ale nie dla kątowej 4+):

Możesz również otworzyć konsolę i przejść do zakładki element w narzędziach programistycznych dowolnej przeglądarki, której używasz.

lub

Typ kątowy.Wersja aby uzyskać dostęp do obiektu Javascript, który posiada wersję kątową.

Dla kątowej 4+ istnieje kilka sposobów wymienionych poniżej:

Wpisz poniższy kod w wierszu polecenia / lub w terminalu w VS Kod.(do 3)

  1. ng version lub ng --version (Znajdź obrazek dla odniesienia)
  2. ng v
  3. ng-v

W terminalu można znaleźć wersję kątową, jak pokazano na załączonym obrazku : Tutaj wpisz opis obrazka

  1. Możesz również otworzyć konsolę i przejść do zakładki element w narzędziach programistycznych dowolnej przeglądarki, której używasz. Jak pokazano na poniższym obrazku:

Tutaj wpisz opis obrazka

  1. Znajdź paczkę.plik json, znajdziesz wszystkie zainstalowane zależności i ich wersję.
 6
Author: Trilok Pathak,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2019-02-25 09:15:12

Istnieje wiele sposobów:

  1. możesz to zweryfikować ze swojego pakietu .JSON plik
  2. używasz następującego polecenia:

Ng --version

Powyższe polecenie spowoduje następujące wyjście:

Angular CLI: 7.0.3

Node: 9.4.0

OS: darwin x64

Angular: 7.0.1

... animations, common, compiler, compiler-cli, core, forms

... http, język-serwis, Platforma-przeglądarka

... platform-browser-dynamic, router

Wersja Pakietu


@angular-devkit / architect 0.10.3

@ angular-devkit/build-angular 0.10.3

@ angular-devkit/build-optimizer 0.10.3

@angular-devkit/build-webpack 0.10.3

@angular-devkit / core 7.0.3

@ angular-devkit / Schematy 7.0.3

@ angular / cli 7.0.3

@ ngtools / webpack 7.0.3

@ Schematy / angular 7.0.3

@ Schematy / update 0.10.3

Rxjs 6.3.3

Typescript 3.1.4

Webpack 4.19.1

Stąd można zweryfikować wersję Angular, Angular CLI, Node i wiele innych pakietów.

 3
Author: Bilal Ahmed Yaseen,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-11-05 06:10:00

Jeśli używasz edytora kodu VS .

Przejdź do Panelu Eksploratora po lewej stronie - > znajdź pakiet.json & otwórz go - > w zależności znajdź @ angular / core.

To jest Twoja wersja kątowa, ponieważ rdzeń jest główną cechą

Tutaj wpisz opis obrazka

Tutaj wpisz opis obrazka

 3
Author: Manoj Kalluri,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-11-27 17:24:04

Do AngularJS - Użyj angular.version

console.log(angular.version);
<script src="//unpkg.com/angular/angular.js"></script>

Aby uzyskać więcej informacji, zobacz

 3
Author: georgeawg,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2020-06-20 09:12:55

W folderze projektu otwórz terminal poleceń i wpisz

ng -v

Da ci listę elementów, w których będziesz mógł zobaczyć wersję kątową. Zobacz zrzut ekranu.

szczegóły wersji

 2
Author: Akbar Badhusha,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-03-10 16:57:10

Wersja po angular 2 możesz używać z Terminala,

ng -v



    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/

Angular CLI: 1.7.3
Node: 9.3.0
OS: linux x64
Angular: 5.2.9
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.7.3
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.5.3
webpack: 3.11.0
mohideen@root:~/apps/UI$ 
 2
Author: Mohideen bin Mohammed,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-03-28 07:00:26

Po prostu przejdź do katalogu projektu angular przez terminal i ng -v Podaj wszystkie informacje w ten sposób

Angular CLI: 1.7.4
Node: 8.11.1
OS: linux x64
Angular: 5.2.11
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.7.4
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.5.3
webpack: 3.11.0

Jeśli sprawdzisz ng-v poza angular project directoty to pokaże tylko wersję angular-cli.

 1
Author: Kamal Kumar,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-06-07 05:44:09

Tutaj wpisz opis obrazkaw nowej wersji angular cli [ng-v] nie będzie działać.musisz wpisać [wersja ng].

 1
Author: SwarupOVO,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-12-05 05:34:58

Możesz również sprawdzić, sprawdzając elementy na stronie:

  1. Naciśnij klawisz F12, aby otworzyć narzędzia programistyczne przeglądarki.

  2. Sprawdź Element.

  3. Rozwiń Ciało

  4. Zobaczysz wersję Angular, jak poniżej:

Ng-wersja="4.3.6"

 1
Author: Nav,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2019-10-02 19:03:25

Będzie tutaj..

../ project_name / bower_components / angular / angular.js

/**
 * @license AngularJS v1.0.6
 * (c) 2010-2012 Google, Inc. http://angularjs.org
 * License: MIT
 */
 0
Author: poojan mehta PM,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-04-19 13:12:34

Możesz po prostu wpisać ng version thats it

 0
Author: Jeff,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-06-29 01:26:06

To bardzo proste., możesz zobaczyć w package.json pliku

 0
Author: user1012506,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-12-05 06:42:10

Tak samo jak powyżej odpowiedź, można sprawdzić w przeglądarce sprawdzając element, jeśli jest to AngularJS możemy zobaczyć coś takiego jak poniżej.

Dyrektywa ng-app mówi AngularJS, że jest to główny element aplikacji AngularJS.

Wszystkie aplikacje AngularJS muszą mieć element root.

 0
Author: Smitha,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2019-07-17 00:57:33

Dla angular JS można go znaleźć na angular-animate.plik js jak poniżej:

/** * @ license AngularJS v1.4.8 * (c) 2010-2015 Google, Inc. http://angularjs.org * Licencja: MIT */

 0
Author: Zakir Hossain,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2019-07-17 04:40:31