Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check Angular2 version with typescript

Tags:

I have written a simple app with [email protected], and it works great. Now that I am testing it with the latest version of the alpha and beta avaible on npm, and I keep wondering if I really really changed or I am caching something.

I want to do something like the below on my root component

export class ChromeComponent {    ngOnInit() {     console.log('angular version');   } } 

angular.version on the console return undefined

like image 964
CESCO Avatar asked Apr 06 '16 16:04

CESCO


People also ask

How do I check my TypeScript version?

Test that the TypeScript is installed correctly by typing tsc -v into your terminal or command prompt. You should see the TypeScript version print out to the screen.

How can I tell what version of TypeScript angular?

It is very easy to know the typescript version in the Angular 13 project. First change to the application directory and run the ng –version command. Typescript 4.4. 4 is the latest version used in the Angular 13 application.

What version of TypeScript does angular 7 use?

Angular 7 uses TypeScript version 3.1.

What version of TypeScript does angular 14 use?

Angular 14 is the most prominent release by Google for web development, based on TypeScript. Angular 14 also supports the latest TypeScript 4.7 release. By default, Angular 14 targets ES2020, allowing the CLI to send smaller code without having to down-level.


1 Answers

Update since 4.0.0-rc.1

Version is added for root selector in the DOM

enter image description here

Since angular2 version 2.3.0-rc.0 you can get version as follows:

import { VERSION } from '@angular/core';  export class AppComponent {    constructor() {     console.log(VERSION.full); // print 2.3.0-rc.0   } } 

Or you can just open browser console and check body tag enter image description here

like image 178
yurzui Avatar answered Nov 15 '22 12:11

yurzui