Skip to content

Commit 6690420

Browse files
committed
Update to Angular v14
1 parent 80202df commit 6690420

34 files changed

+254
-156
lines changed

APM-Final/.browserslistrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ last 2 Edge major versions
1414
last 2 Safari major versions
1515
last 2 iOS major versions
1616
Firefox ESR
17-
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

APM-Final/.gitignore

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,42 @@
11
# See http://help.github.com/ignore-files/ for more about ignoring files.
22

3-
# compiled output
3+
# Compiled output
44
/dist
55
/tmp
66
/out-tsc
7-
# Only exists if Bazel was run
87
/bazel-out
98

10-
# dependencies
9+
# Node
1110
/node_modules
12-
13-
# profiling files
14-
chrome-profiler-events*.json
11+
npm-debug.log
12+
yarn-error.log
1513

1614
# IDEs and editors
17-
/.idea
15+
.idea/
1816
.project
1917
.classpath
2018
.c9/
2119
*.launch
2220
.settings/
2321
*.sublime-workspace
2422

25-
# IDE - VSCode
23+
# Visual Studio Code
2624
.vscode/*
2725
!.vscode/settings.json
2826
!.vscode/tasks.json
2927
!.vscode/launch.json
3028
!.vscode/extensions.json
3129
.history/*
3230

33-
# misc
34-
/.sass-cache
31+
# Miscellaneous
32+
/.angular/cache
33+
.sass-cache/
3534
/connect.lock
3635
/coverage
3736
/libpeerconnection.log
38-
npm-debug.log
39-
yarn-error.log
4037
testem.log
4138
/typings
4239

43-
# System Files
40+
# System files
4441
.DS_Store
4542
Thumbs.db

APM-Final/.vscode/extensions.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
3+
"recommendations": ["angular.ng-template"]
4+
}

APM-Final/.vscode/launch.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
3+
"version": "0.2.0",
4+
"configurations": [
5+
{
6+
"name": "ng serve",
7+
"type": "pwa-chrome",
8+
"request": "launch",
9+
"preLaunchTask": "npm: start",
10+
"url": "http://localhost:4200/"
11+
},
12+
{
13+
"name": "ng test",
14+
"type": "chrome",
15+
"request": "launch",
16+
"preLaunchTask": "npm: test",
17+
"url": "http://localhost:9876/debug.html"
18+
}
19+
]
20+
}

APM-Final/.vscode/tasks.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
3+
"version": "2.0.0",
4+
"tasks": [
5+
{
6+
"type": "npm",
7+
"script": "start",
8+
"isBackground": true,
9+
"problemMatcher": {
10+
"owner": "typescript",
11+
"pattern": "$tsc",
12+
"background": {
13+
"activeOnStart": true,
14+
"beginsPattern": {
15+
"regexp": "(.*?)"
16+
},
17+
"endsPattern": {
18+
"regexp": "bundle generation complete"
19+
}
20+
}
21+
}
22+
},
23+
{
24+
"type": "npm",
25+
"script": "test",
26+
"isBackground": true,
27+
"problemMatcher": {
28+
"owner": "typescript",
29+
"pattern": "$tsc",
30+
"background": {
31+
"activeOnStart": true,
32+
"beginsPattern": {
33+
"regexp": "(.*?)"
34+
},
35+
"endsPattern": {
36+
"regexp": "bundle generation complete"
37+
}
38+
}
39+
}
40+
}
41+
]
42+
}

APM-Final/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
# Apm
22

3-
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.0.0.
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.0.3.
44

55
## Development server
66

7-
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
7+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
88

99
## Code scaffolding
1010

1111
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
1212

1313
## Build
1414

15-
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
15+
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
1616

1717
## Running unit tests
1818

1919
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
2020

2121
## Running end-to-end tests
2222

23-
Run `ng e2e` to execute the end-to-end tests via a platform of your choice.
23+
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
2424

2525
## Further help
2626

APM-Final/angular.json

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
{
22
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3-
"cli": {
4-
"analytics": "25966e0b-559a-45fe-b9d4-ae4bd482836a"
5-
},
63
"version": 1,
74
"newProjectRoot": "projects",
85
"projects": {
96
"apm": {
107
"projectType": "application",
11-
"schematics": {
12-
"@schematics/angular:application": {
13-
"strict": true
14-
}
15-
},
8+
"schematics": {},
169
"root": "",
1710
"sourceRoot": "src",
1811
"prefix": "pm",
@@ -106,5 +99,7 @@
10699
}
107100
}
108101
},
109-
"defaultProject": "apm"
110-
}
102+
"cli": {
103+
"analytics": "b3d9f0d9-807a-4e42-8023-9a87197da51f"
104+
},
105+
}

APM-Final/package.json

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,31 @@
1010
},
1111
"private": true,
1212
"dependencies": {
13-
"@angular/animations": "~12.0.0",
14-
"@angular/common": "~12.0.0",
15-
"@angular/compiler": "~12.0.0",
16-
"@angular/core": "~12.0.0",
17-
"@angular/forms": "~12.0.0",
18-
"@angular/platform-browser": "~12.0.0",
19-
"@angular/platform-browser-dynamic": "~12.0.0",
20-
"@angular/router": "~12.0.0",
21-
"bootstrap": "^5.0.1",
13+
"@angular/animations": "^14.0.0",
14+
"@angular/common": "^14.0.0",
15+
"@angular/compiler": "^14.0.0",
16+
"@angular/core": "^14.0.0",
17+
"@angular/forms": "^14.0.0",
18+
"@angular/platform-browser": "^14.0.0",
19+
"@angular/platform-browser-dynamic": "^14.0.0",
20+
"@angular/router": "^14.0.0",
21+
"bootstrap": "^5.1.3",
2222
"font-awesome": "^4.7.0",
23-
"rxjs": "~6.6.0",
24-
"tslib": "^2.1.0",
23+
"rxjs": "~7.5.0",
24+
"tslib": "^2.3.0",
2525
"zone.js": "~0.11.4"
2626
},
2727
"devDependencies": {
28-
"@angular-devkit/build-angular": "~12.0.0",
29-
"@angular/cli": "~12.0.0",
30-
"@angular/compiler-cli": "~12.0.0",
31-
"@types/jasmine": "~3.6.0",
32-
"@types/node": "^12.11.1",
33-
"jasmine-core": "~3.7.0",
28+
"@angular-devkit/build-angular": "^14.0.3",
29+
"@angular/cli": "~14.0.3",
30+
"@angular/compiler-cli": "^14.0.0",
31+
"@types/jasmine": "~4.0.0",
32+
"jasmine-core": "~4.1.0",
3433
"karma": "~6.3.0",
3534
"karma-chrome-launcher": "~3.1.0",
36-
"karma-coverage": "~2.0.3",
37-
"karma-jasmine": "~4.0.0",
38-
"karma-jasmine-html-reporter": "^1.5.0",
39-
"typescript": "~4.2.3"
35+
"karma-coverage": "~2.2.0",
36+
"karma-jasmine": "~5.0.0",
37+
"karma-jasmine-html-reporter": "~1.7.0",
38+
"typescript": "~4.7.2"
4039
}
4140
}

APM-Final/src/app/app.component.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<!--The content below is only a placeholder and can be replaced.-->
21
<div style="text-align:center">
32
<h1>
43
TaDa! Welcome to {{title}}!!

APM-Final/src/app/app.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('AppComponent', () => {
2525
it('should render title', () => {
2626
const fixture = TestBed.createComponent(AppComponent);
2727
fixture.detectChanges();
28-
const compiled = fixture.nativeElement;
28+
const compiled = fixture.nativeElement as HTMLElement;
2929
expect(compiled.querySelector('h1').textContent).toContain('Welcome to Angular: Getting Started!!');
3030
});
3131
});

APM-Final/src/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component } from '@angular/core';
1+
import { Component } from "@angular/core";
22

33
@Component({
44
selector: 'pm-root',

APM-Final/src/app/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { BrowserModule } from '@angular/platform-browser';
21
import { NgModule } from '@angular/core';
2+
import { BrowserModule } from '@angular/platform-browser';
33
import { HttpClientModule } from '@angular/common/http';
44

55
import { AppComponent } from './app.component';

APM-Final/src/app/products/product-detail.component.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ describe('ProductDetailComponent', () => {
1111
declarations: [ ProductDetailComponent ]
1212
})
1313
.compileComponents();
14-
});
1514

16-
beforeEach(() => {
1715
fixture = TestBed.createComponent(ProductDetailComponent);
1816
component = fixture.componentInstance;
1917
fixture.detectChanges();

APM-Final/src/app/products/product-list.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ <h4>Filtered by: {{listFilter}}</h4>
5050
</td>
5151
<td>{{ product.productCode | lowercase | convertToSpaces:'-' }}</td>
5252
<td>{{ product.releaseDate }}</td>
53-
<td>{{ product.price | currency:'USD':'symbol':'1.2-2'}}</td>
53+
<td>{{ product.price | currency:'USD':'symbol':'1.2-2' }}</td>
5454
<td>
5555
<pm-star [rating]='product.starRating'
5656
(ratingClicked)='onRatingClicked($event)'>

APM-Final/src/app/products/product-list.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { Component, OnDestroy, OnInit } from '@angular/core';
2-
import { Subscription } from 'rxjs';
3-
import { IProduct } from './product';
4-
import { ProductService } from './product.service';
1+
import { Component, OnDestroy, OnInit } from "@angular/core";
2+
import { Subscription } from "rxjs";
3+
import { IProduct } from "./product";
4+
import { ProductService } from "./product.service";
55

66
@Component({
77
templateUrl: './product-list.component.html',

APM-Final/src/app/products/product.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { HttpClient, HttpErrorResponse } from "@angular/common/http";
22
import { Injectable } from "@angular/core";
3-
import { Observable, throwError } from "rxjs";
4-
import { catchError, map, tap } from 'rxjs/operators';
3+
import { Observable, catchError, tap, throwError, map } from "rxjs";
4+
55
import { IProduct } from "./product";
66

77
@Injectable({
@@ -46,7 +46,7 @@ export class ProductService {
4646
errorMessage = `Server returned code: ${err.status}, error message is: ${err.message}`;
4747
}
4848
console.error(errorMessage);
49-
return throwError(errorMessage);
49+
return throwError(() => errorMessage);
5050
}
5151

5252
}

APM-Final/src/polyfills.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
* file.
99
*
1010
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11-
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12-
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
11+
* automatically update themselves. This includes recent versions of Safari, Chrome (including
12+
* Opera), Edge on the desktop, and iOS and Chrome on mobile.
1313
*
1414
* Learn more in https://angular.io/guide/browser-support
1515
*/
@@ -18,18 +18,6 @@
1818
* BROWSER POLYFILLS
1919
*/
2020

21-
/**
22-
* IE11 requires the following for NgClass support on SVG elements
23-
*/
24-
// import 'classlist.js'; // Run `npm install --save classlist.js`.
25-
26-
/**
27-
* Web Animations `@angular/platform-browser/animations`
28-
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
29-
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
30-
*/
31-
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
32-
3321
/**
3422
* By default, zone.js will patch all possible macroTask and DomEvents
3523
* user can disable parts of macroTask/DomEvents patch by setting following flags

APM-Final/src/styles.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ div.card {
1717
a {
1818
text-decoration: none;
1919
}
20+
2021
a:hover {
2122
text-decoration: underline;
2223
}

APM-Final/src/test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@ import {
99

1010
declare const require: {
1111
context(path: string, deep?: boolean, filter?: RegExp): {
12-
keys(): string[];
1312
<T>(id: string): T;
13+
keys(): string[];
1414
};
1515
};
1616

1717
// First, initialize the Angular testing environment.
1818
getTestBed().initTestEnvironment(
1919
BrowserDynamicTestingModule,
20-
platformBrowserDynamicTesting()
20+
platformBrowserDynamicTesting(),
2121
);
22+
2223
// Then we find all the tests.
2324
const context = require.context('./', true, /\.spec\.ts$/);
2425
// And load the modules.
25-
context.keys().map(context);
26+
context.keys().forEach(context);

0 commit comments

Comments
 (0)