Skip to content

Commit 72a8d5d

Browse files
committed
Update to Angular 4.3.1 and CLI 1.2.4
1 parent b8f0b27 commit 72a8d5d

14 files changed

+50
-29
lines changed

APM-CLI-Final/.angular-cli.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,16 @@
3838
},
3939
"lint": [
4040
{
41-
"project": "src/tsconfig.app.json"
41+
"project": "src/tsconfig.app.json",
42+
"exclude": "**/node_modules/**"
4243
},
4344
{
44-
"project": "src/tsconfig.spec.json"
45+
"project": "src/tsconfig.spec.json",
46+
"exclude": "**/node_modules/**"
4547
},
4648
{
47-
"project": "e2e/tsconfig.e2e.json"
49+
"project": "e2e/tsconfig.e2e.json",
50+
"exclude": "**/node_modules/**"
4851
}
4952
],
5053
"test": {

APM-CLI-Final/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# APM
22

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

55
## Development server
66

APM-CLI-Final/e2e/tsconfig.e2e.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
"extends": "../tsconfig.json",
33
"compilerOptions": {
44
"outDir": "../out-tsc/e2e",
5+
"baseUrl": "./",
56
"module": "commonjs",
67
"target": "es5",
78
"types": [
89
"jasmine",
10+
"jasminewd2",
911
"node"
1012
]
1113
}

APM-CLI-Final/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
"@angular/router": "^4.0.0",
2424
"bootstrap": "^3.3.7",
2525
"core-js": "^2.4.1",
26-
"rxjs": "^5.1.0",
27-
"zone.js": "^0.8.4"
26+
"rxjs": "^5.4.1",
27+
"zone.js": "^0.8.14"
2828
},
2929
"devDependencies": {
30-
"@angular/cli": "1.2.0",
30+
"@angular/cli": "1.2.4",
3131
"@angular/compiler-cli": "^4.0.0",
3232
"@angular/language-service": "^4.0.0",
3333
"@types/jasmine": "~2.5.53",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { BrowserModule } from '@angular/platform-browser';
22
import { NgModule } from '@angular/core';
3-
import { HttpModule } from '@angular/http';
3+
import { HttpClientModule } from '@angular/common/http';
44
import { RouterModule } from '@angular/router';
55

66
import { AppComponent } from './app.component';
@@ -14,7 +14,7 @@ import { ProductModule } from './products/product.module';
1414
],
1515
imports: [
1616
BrowserModule,
17-
HttpModule,
17+
HttpClientModule,
1818
RouterModule.forRoot([
1919
{ path: 'welcome', component: WelcomeComponent },
2020
{ path: '', redirectTo: 'welcome', pathMatch: 'full'},

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class ProductGuardService implements CanActivate {
1212
alert('Invalid product Id');
1313
this._router.navigate(['/products']);
1414
return false;
15-
};
15+
}
1616
return true;
1717
}
1818
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ <h3>Filtered by: {{listFilter}} </h3>
5959
</div>
6060
</div>
6161
</div>
62+
<div *ngIf='errorMessage' class='alert alert-danger'>
63+
Error: {{ errorMessage }}
64+
</div>
Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Injectable } from '@angular/core';
2-
import { Http, Response } from '@angular/http';
2+
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
33
import { Observable } from 'rxjs/Observable';
44
import 'rxjs/add/observable/throw';
55
import 'rxjs/add/operator/catch';
@@ -10,13 +10,12 @@ import { IProduct } from './product';
1010

1111
@Injectable()
1212
export class ProductService {
13-
private _productUrl = 'api/products/products.json';
13+
private _productUrl = './api/products/products.json';
1414

15-
constructor(private _http: Http) { }
15+
constructor(private _http: HttpClient) { }
1616

1717
getProducts(): Observable<IProduct[]> {
18-
return this._http.get(this._productUrl)
19-
.map((response: Response) => <IProduct[]>response.json())
18+
return this._http.get<IProduct[]>(this._productUrl)
2019
.do(data => console.log('All: ' + JSON.stringify(data)))
2120
.catch(this.handleError);
2221
}
@@ -26,10 +25,19 @@ export class ProductService {
2625
.map((products: IProduct[]) => products.find(p => p.productId === id));
2726
}
2827

29-
private handleError(error: Response) {
28+
private handleError(err: HttpErrorResponse) {
3029
// in a real world app, we may send the server to some remote logging infrastructure
3130
// instead of just logging it to the console
32-
console.error(error);
33-
return Observable.throw(error.json().error || 'Server error');
31+
let errorMessage = '';
32+
if (err.error instanceof Error) {
33+
// A client-side or network error occurred. Handle it accordingly.
34+
errorMessage = `An error occurred: ${err.error.message}`;
35+
} else {
36+
// The backend returned an unsuccessful response code.
37+
// The response body may contain clues as to what went wrong,
38+
errorMessage = `Server returned code: ${err.status}, error message is: ${err.message}`;
39+
}
40+
console.log(err);
41+
return Observable.throw(errorMessage);
3442
}
3543
}

APM-CLI-Final/src/polyfills.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,15 @@
3737
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
3838
// import 'classlist.js'; // Run `npm install --save classlist.js`.
3939

40-
/** IE10 and IE11 requires the following to support `@angular/animation`. */
41-
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
42-
43-
4440
/** Evergreen browsers require these. **/
4541
import 'core-js/es6/reflect';
4642
import 'core-js/es7/reflect';
4743

4844

49-
/** ALL Firefox browsers require the following to support `@angular/animation`. **/
45+
/**
46+
* Required to support Web Animations `@angular/animation`.
47+
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
48+
**/
5049
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
5150

5251

APM-CLI-Final/src/tsconfig.app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"extends": "../tsconfig.json",
33
"compilerOptions": {
44
"outDir": "../out-tsc/app",
5+
"baseUrl": "./",
56
"module": "es2015",
6-
"baseUrl": "",
77
"types": []
88
},
99
"exclude": [

APM-CLI-Final/src/tsconfig.spec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"extends": "../tsconfig.json",
33
"compilerOptions": {
44
"outDir": "../out-tsc/spec",
5+
"baseUrl": "./",
56
"module": "commonjs",
67
"target": "es5",
7-
"baseUrl": "",
88
"types": [
99
"jasmine",
1010
"node"

APM-CLI-Final/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"compileOnSave": false,
33
"compilerOptions": {
44
"outDir": "./dist/out-tsc",
5-
"baseUrl": "src",
65
"sourceMap": true,
76
"declaration": false,
87
"moduleResolution": "node",

APM-CLI-Final/tslint.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,14 @@
3131
"member-access": false,
3232
"member-ordering": [
3333
true,
34-
"static-before-instance",
35-
"variables-before-functions"
34+
{
35+
"order": [
36+
"static-field",
37+
"instance-field",
38+
"static-method",
39+
"instance-method"
40+
]
41+
}
3642
],
3743
"no-arg": true,
3844
"no-bitwise": true,
@@ -80,6 +86,7 @@
8086
],
8187
"radix": true,
8288
"semicolon": [
89+
true,
8390
"always"
8491
],
8592
"triple-equals": [

APM-CLI-Start/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"zone.js": "^0.8.4"
2828
},
2929
"devDependencies": {
30-
"@angular/cli": "1.2.0",
30+
"@angular/cli": "^1.2.4",
3131
"@angular/compiler-cli": "^4.0.0",
3232
"@angular/language-service": "^4.0.0",
3333
"@types/jasmine": "~2.5.53",

0 commit comments

Comments
 (0)