Skip to content

Commit 951af4d

Browse files
committed
Upgrade to Angular2-rc1
1 parent dd1dcd3 commit 951af4d

File tree

11 files changed

+93
-46
lines changed

11 files changed

+93
-46
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
typings
22
node_modules
33
/**/*.js
4-
!bs-config.js
4+
!/*.js
55
/**/*.map

app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Created by pizzo on 28/02/16.
33
*/
4-
import {Component} from "angular2/core";
4+
import {Component} from "@angular/core";
55
import {TodoFormComponent} from "./todo-form.component";
66
import {TodoListComponent} from "./todo-list.component";
77
import {Todo} from "./models/todo";

app/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
22
* Created by pizzo on 28/02/16.
33
*/
4-
import {bootstrap} from 'angular2/platform/browser';
4+
import {bootstrap} from '@angular/platform-browser-dynamic';
55
import {AppComponent} from './app.component';
6-
import {HTTP_PROVIDERS} from "angular2/http";
6+
import {HTTP_PROVIDERS} from "@angular/http";
77
// Add all operators to Observable
88
import 'rxjs/Rx';
99

app/services/todo-list.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
22
* Created by pizzo on 13/03/16.
33
*/
4-
import {Injectable} from "angular2/core";
4+
import {Injectable} from "@angular/core";
55
import {Todo} from "../models/todo";
6-
import {Http, RequestOptions, Headers} from "angular2/http";
6+
import {Http, RequestOptions, Headers} from "@angular/http";
77
import {Observable} from "rxjs/Observable";
88

99
@Injectable()

app/todo-form.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Created by pizzo on 28/02/16.
33
*/
4-
import {Component, Output, EventEmitter} from "angular2/core";
4+
import {Component, Output, EventEmitter} from "@angular/core";
55

66
@Component({
77
selector: 'todo-form',
@@ -21,7 +21,7 @@ import {Component, Output, EventEmitter} from "angular2/core";
2121
})
2222
export class TodoFormComponent {
2323

24-
@Output() onNewElement: EventEmitter = new EventEmitter<string>();
24+
@Output() onNewElement: EventEmitter<string> = new EventEmitter<string>();
2525

2626
private element = '';
2727

app/todo-list.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Created by pizzo on 28/02/16.
33
*/
4-
import {Component, Input, OnInit} from "angular2/core";
4+
import {Component, Input, OnInit} from "@angular/core";
55
import {Todo} from "./models/todo";
66
import {TodoListService} from "./services/todo-list.service";
77

index.html

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,20 @@
11
<html>
22
<head>
3-
<base href="/">
43
<title>Angular 2 QuickStart</title>
4+
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1">
6-
76
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
8-
97
<!-- 1. Load libraries -->
10-
<!-- IE required polyfills, in this exact order -->
8+
<!-- Polyfill(s) for older browsers -->
119
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
12-
<script src="node_modules/systemjs/dist/system-polyfills.js"></script>
13-
14-
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
10+
<script src="node_modules/zone.js/dist/zone.js"></script>
11+
<script src="node_modules/reflect-metadata/Reflect.js"></script>
1512
<script src="node_modules/systemjs/dist/system.src.js"></script>
16-
<script src="node_modules/rxjs/bundles/Rx.js"></script>
17-
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
18-
<script src="node_modules/angular2/bundles/router.dev.js"></script>
19-
<script src="node_modules/angular2/bundles/http.dev.js"></script>
20-
2113
<!-- 2. Configure SystemJS -->
14+
<script src="systemjs.config.js"></script>
2215
<script>
23-
System.config({
24-
packages: {
25-
app: {
26-
format: 'register',
27-
defaultExtension: 'js'
28-
}
29-
}
30-
});
31-
System.import('app/main')
32-
.then(null, console.error.bind(console));
16+
System.import('app').catch(function(err){ console.error(err); });
3317
</script>
34-
3518
</head>
3619

3720
<!-- 3. Display the application -->

package.json

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "angular2-todo-list",
33
"version": "1.0.0",
44
"scripts": {
5-
"start": "concurrently \"npm run tsc:w\" \"npm run lite\" \"npm run start-backend\"",
5+
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" \"npm run start-backend\" ",
66
"start-backend": "nodemon ./backend/bin/www",
77
"tsc": "tsc",
88
"tsc:w": "tsc -w",
@@ -12,19 +12,28 @@
1212
},
1313
"license": "ISC",
1414
"dependencies": {
15-
"angular2": "2.0.0-beta.7",
16-
"systemjs": "0.19.22",
17-
"es6-promise": "^3.0.2",
18-
"es6-shim": "^0.33.3",
19-
"reflect-metadata": "0.1.2",
20-
"rxjs": "5.0.0-beta.2",
21-
"zone.js": "0.5.15"
15+
"@angular/common": "2.0.0-rc.1",
16+
"@angular/compiler": "2.0.0-rc.1",
17+
"@angular/core": "2.0.0-rc.1",
18+
"@angular/http": "2.0.0-rc.1",
19+
"@angular/platform-browser": "2.0.0-rc.1",
20+
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
21+
"@angular/router": "2.0.0-rc.1",
22+
"@angular/router-deprecated": "2.0.0-rc.1",
23+
"@angular/upgrade": "2.0.0-rc.1",
24+
"systemjs": "0.19.27",
25+
"es6-shim": "^0.35.0",
26+
"reflect-metadata": "^0.1.3",
27+
"rxjs": "5.0.0-beta.6",
28+
"zone.js": "^0.6.12",
29+
"angular2-in-memory-web-api": "0.0.7",
30+
"bootstrap": "^3.3.6"
2231
},
2332
"devDependencies": {
2433
"concurrently": "^2.0.0",
25-
"lite-server": "^2.1.0",
26-
"proxy-middleware": "^0.15.0",
27-
"typescript": "^1.7.5",
28-
"typings": "^0.6.8"
34+
"lite-server": "^2.2.0",
35+
"typescript": "^1.8.10",
36+
"typings":"^0.8.1",
37+
"proxy-middleware": "^0.15.0"
2938
}
3039
}

systemjs.config.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/**
2+
* System configuration for Angular 2 apps
3+
* Adjust as necessary for your application needs.
4+
*/
5+
(function(global) {
6+
7+
// map tells the System loader where to look for things
8+
var map = {
9+
'app': 'app', // 'dist',
10+
11+
'@angular': 'node_modules/@angular',
12+
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
13+
'rxjs': 'node_modules/rxjs'
14+
};
15+
16+
// packages tells the System loader how to load when no filename and/or no extension
17+
var packages = {
18+
'app': { main: 'main.js', defaultExtension: 'js' },
19+
'rxjs': { defaultExtension: 'js' },
20+
'angular2-in-memory-web-api': { defaultExtension: 'js' },
21+
};
22+
23+
var ngPackageNames = [
24+
'common',
25+
'compiler',
26+
'core',
27+
'http',
28+
'platform-browser',
29+
'platform-browser-dynamic',
30+
'router',
31+
'router-deprecated',
32+
'upgrade'
33+
];
34+
35+
// Add package entries for angular packages
36+
ngPackageNames.forEach(function(pkgName) {
37+
38+
// Bundled (~40 requests):
39+
packages['@angular/'+pkgName] = { main: pkgName + '.umd.js', defaultExtension: 'js' };
40+
41+
// Individual files (~300 requests):
42+
//packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
43+
});
44+
45+
var config = {
46+
map: map,
47+
packages: packages
48+
};
49+
50+
System.config(config);
51+
52+
})(this);

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"compilerOptions": {
33
"target": "es5",
4-
"module": "system",
4+
"module": "commonjs",
55
"moduleResolution": "node",
66
"sourceMap": true,
77
"emitDecoratorMetadata": true,
88
"experimentalDecorators": true,
99
"removeComments": false,
1010
"noImplicitAny": false
11+
1112
},
1213
"exclude": [
1314
"node_modules",

0 commit comments

Comments
 (0)