| Angular CLI version | Angular version | Node.js version | TypeScript version |
|---|---|---|---|
| - | 2.x | 6.0.x or later minor version | 2.0.x |
| 1.0.6 | 4.x | 6.9.x or later minor version | 2.2.x |
| 1.1.3 | 4.x | 6.9.x or later minor version | 2.3.x |
| 1.2.7 | 4.x | 6.9.x or later minor version | 2.3.x |
| 1.3.2 | 4.2.x or later minor version | 6.9.x or later minor version | 2.4.x |
| 1.4.10 | 4.2.x or later minor version | 6.9.x/8.9.x or later minor version | 2.4.x |
| (1.5.6) | 5.0.x | 6.9.x/8.9.x or later minor version | 2.4.x |
| 1.5.6 | 5.1.x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Injectable, Inject } from '@angular/core'; | |
| import { configToken } from './config.token'; | |
| import { Config } from './config'; | |
| @Injectable({ | |
| providedIn: 'any', // 👈 Tree-shakable, only bundled if used | |
| }) | |
| export class ConfigService { | |
| constructor(@Inject(configToken) private config: Config) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Location } from '@angular/common'; | |
| import { Component, Injectable, NgModule, NgZone } from '@angular/core'; | |
| import { TestBed } from '@angular/core/testing'; | |
| import { Router, RouterModule, Routes } from '@angular/router'; | |
| import { RouterTestingModule } from '@angular/router/testing'; | |
| import { of } from 'rxjs'; | |
| import { AuthGuard } from './auth.guard'; | |
| import { AuthService } from './auth.service'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { | |
| ActivatedRouteSnapshot, | |
| Params, | |
| Route, | |
| Router, | |
| RouterStateSnapshot, | |
| UrlSegment, | |
| } from '@angular/router'; | |
| import { AuthGuard } from './auth.guard'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { DOCUMENT } from '@angular/common'; | |
| import { Inject, Injectable, Renderer2 } from '@angular/core'; | |
| import { Observable, ReplaySubject } from 'rxjs'; | |
| import { switchMapTo, tap } from 'rxjs/operators'; | |
| @Injectable({ | |
| providedIn: 'root', | |
| }) | |
| export class ScriptService { | |
| private scriptLoaded = new Map<string, Observable<void>>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div *ngIf="hero"> | |
| <h2> | |
| {{hero.name | uppercase}} Details | |
| </h2> | |
| <div> | |
| <span>id:</span> | |
| {{hero.id}} | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div *ngIf="hero"> | |
| <h2> | |
| {{hero.name | uppercase}} Details | |
| </h2> | |
| <div> | |
| <span>id:</span> | |
| {{hero.id}} | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h3>Top Heroes</h3> | |
| <div class="grid grid-pad"> | |
| <a *ngFor="let hero of heroes" class="col-1-4" | |
| routerLink="/detail/{{hero.id}}"> | |
| <div class="module hero"> | |
| <h4>{{hero.name}}</h4> | |
| </div> | |
| </a> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const childProcess = require('child_process'); | |
| const fs = require('fs'); | |
| const yargs = require('yargs'); | |
| function addScopeToLibraryProjectName({ name, scope }) { | |
| runCommand('npx json -I -f angular.json ' | |
| + `-e "this.projects['${scope}-${name}'] = this.projects['${name}']"`); | |
| runCommand(`npx json -I -f angular.json -e "delete this.projects['${name}']"`); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Angular version | Application engine | Library engine | Status | |
|---|---|---|---|---|
| Version 9 | View Engine | View Engine | Supported, but not recommended | |
| Version 9 | View Engine | Ivy | Not supported | |
| Version 9 | Ivy | View Engine | Recommended | |
| Version 9 | Ivy | Ivy | Supported, but not recommended | |
| Version 10 | View Engine | View Engine | Supported, but not recommended | |
| Version 10 | View Engine | Ivy | Not supported | |
| Version 10 | Ivy | View Engine | Supported, but not recommended | |
| Version 10 | Ivy | Ivy | Recommended | |
| Version 11 | View Engine | View Engine | Not supported |