Skip to content

Commit 73ea023

Browse files
authored
Merge pull request #9 from boulc/angular-2.1.2
Upgrade to angular 2.1.2
2 parents eedde64 + ead0a0d commit 73ea023

File tree

6 files changed

+123
-105
lines changed

6 files changed

+123
-105
lines changed

angular2-signalr/client/app/app.component.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {Component, OnInit} from '@angular/core';
22
import {Observable} from "rxjs/Observable";
33

44
import {ChannelService, ConnectionState} from "./services/channel.service";
5-
import {TaskComponent} from "./task.component";
65

76
@Component({
87
selector: 'my-app',
@@ -24,8 +23,7 @@ import {TaskComponent} from "./task.component";
2423
[apiUrl]="'http://localhost:9123/tasks/short'"></task>
2524
</div>
2625
27-
`,
28-
directives: [TaskComponent]
26+
`
2927
})
3028
export class AppComponent implements OnInit {
3129

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { NgModule } from '@angular/core';
2+
import { BrowserModule } from '@angular/platform-browser';
3+
import { HttpModule } from '@angular/http';
4+
5+
import "rxjs/add/operator/map";
6+
7+
import {ChannelService, ChannelConfig, SignalrWindow} from "./services/channel.service";
8+
9+
import { AppComponent } from './app.component';
10+
import { TaskComponent } from "./task.component";
11+
12+
let channelConfig = new ChannelConfig();
13+
channelConfig.url = "http://localhost:9123/signalr";
14+
channelConfig.hubName = "EventHub";
15+
16+
@NgModule({
17+
imports: [ BrowserModule, HttpModule ],
18+
declarations: [ AppComponent, TaskComponent ],
19+
providers: [
20+
ChannelService,
21+
{ provide: SignalrWindow, useValue: window },
22+
{ provide: 'channel.config', useValue: channelConfig }
23+
],
24+
bootstrap: [ AppComponent ]
25+
})
26+
27+
export class AppModule { }

angular2-signalr/client/app/main.ts

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
1-
import {bootstrap} from '@angular/platform-browser-dynamic';
2-
import {provide} from "@angular/core";
3-
import {HTTP_PROVIDERS} from "@angular/http";
1+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
42

5-
import "rxjs/add/operator/map";
3+
import { AppModule } from './app.module';
64

7-
import {AppComponent} from './app.component';
8-
9-
import {ChannelService, ChannelConfig, SignalrWindow} from "./services/channel.service";
10-
11-
12-
let channelConfig = new ChannelConfig();
13-
channelConfig.url = "http://localhost:9123/signalr";
14-
channelConfig.hubName = "EventHub";
15-
16-
bootstrap(AppComponent, [
17-
HTTP_PROVIDERS,
18-
ChannelService,
19-
provide(SignalrWindow, {useValue: window}),
20-
provide("channel.config", { useValue: channelConfig })
21-
]);
5+
const platform = platformBrowserDynamic();
6+
platform.bootstrapModule(AppModule);

angular2-signalr/client/index.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<title>Angular 2 QuickStart</title>
4+
<title>Angular QuickStart</title>
5+
<meta charset="UTF-8">
56
<meta name="viewport" content="width=device-width, initial-scale=1">
67
<link rel="stylesheet" href="styles.css">
78

89
<!-- 1. Load libraries -->
9-
<!-- IE required polyfills, in this exact order -->
10-
<script src="https://unpkg.com/es6-shim@0.35.0/es6-shim.min.js"></script>
10+
<!-- Polyfill for older browsers -->
11+
<script src="node_modules/core-js/client/shim.min.js"></script>
12+
13+
<script src="node_modules/zone.js/dist/zone.js"></script>
14+
<script src="node_modules/reflect-metadata/Reflect.js"></script>
15+
<script src="node_modules/systemjs/dist/system.src.js"></script>
1116

12-
<script src="https://unpkg.com/zone.js@0.6.12?main=browser"></script>
13-
<script src="https://unpkg.com/reflect-metadata@0.1.3"></script>
14-
<script src="https://unpkg.com/systemjs@0.19.27/dist/system.src.js"></script>
15-
1617
<!-- Include SignalR (& jQuery since it requires it) -->
17-
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.2.1.min.js"></script>
18-
<script src="https://ajax.aspnetcdn.com/ajax/signalr/jquery.signalr-2.2.0.min.js"></script>
19-
20-
<!-- 2. Configure SystemJS -->
18+
<script src="node_modules/jquery/dist/jquery.js"></script>
19+
<script src="node_modules/signalr/jquery.signalr.js"></script>
20+
2121
<!-- 2. Configure SystemJS -->
2222
<script src="systemjs.config.js"></script>
2323
<script>

angular2-signalr/client/package.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "angular2-signalr",
3+
"version": "1.0.0",
4+
"scripts": {
5+
"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
6+
"lite": "lite-server",
7+
"tsc": "tsc",
8+
"tsc:w": "tsc -w"
9+
},
10+
"licenses": [
11+
{
12+
"type": "MIT",
13+
"url": "https://github.com/angular/angular.io/blob/master/LICENSE"
14+
}
15+
],
16+
"dependencies": {
17+
"@angular/common": "~2.1.1",
18+
"@angular/compiler": "~2.1.1",
19+
"@angular/core": "~2.1.1",
20+
"@angular/forms": "~2.1.1",
21+
"@angular/http": "~2.1.1",
22+
"@angular/platform-browser": "~2.1.1",
23+
"@angular/platform-browser-dynamic": "~2.1.1",
24+
"@angular/router": "~3.1.1",
25+
"@angular/upgrade": "~2.1.1",
26+
"angular-in-memory-web-api": "~0.1.13",
27+
"core-js": "^2.4.1",
28+
"reflect-metadata": "^0.1.8",
29+
"rxjs": "5.0.0-beta.12",
30+
"signalr": "~2.2.1",
31+
"systemjs": "0.19.39",
32+
"zone.js": "^0.6.25"
33+
},
34+
"devDependencies": {
35+
"@types/core-js": "^0.9.34",
36+
"@types/node": "^6.0.45",
37+
"concurrently": "^3.0.0",
38+
"lite-server": "^2.2.2",
39+
"typescript": "^2.0.3"
40+
}
41+
}
Lines changed: 39 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,42 @@
11
/**
2-
* PLUNKER VERSION (based on systemjs.config.js in angular.io)
3-
* System configuration for Angular 2 samples
2+
* System configuration for Angular samples
43
* Adjust as necessary for your application needs.
54
*/
6-
(function(global) {
7-
8-
var ngVer = '@2.0.0-rc.1'; // lock in the angular package version; do not let it float to current!
9-
10-
//map tells the System loader where to look for things
11-
var map = {
12-
'app': 'app',
13-
14-
'@angular': 'https://unpkg.com/@angular', // sufficient if we didn't pin the version
15-
'rxjs': 'https://unpkg.com/rxjs@5.0.0-beta.6',
16-
'ts': 'https://unpkg.com/plugin-typescript@4.0.10/lib/plugin.js',
17-
'typescript': 'https://unpkg.com/typescript@1.8.10/lib/typescript.js',
18-
};
19-
20-
//packages tells the System loader how to load when no filename and/or no extension
21-
var packages = {
22-
'app': { main: 'main.ts', defaultExtension: 'ts' },
23-
'rxjs': { defaultExtension: 'js' }
24-
};
25-
26-
var ngPackageNames = [
27-
'common',
28-
'compiler',
29-
'core',
30-
'http',
31-
'platform-browser',
32-
'platform-browser-dynamic'
33-
];
34-
35-
// Add map entries for each angular package
36-
// only because we're pinning the version with `ngVer`.
37-
ngPackageNames.forEach(function(pkgName) {
38-
map['@angular/'+pkgName] = 'https://unpkg.com/@angular/' + pkgName + ngVer;
39-
});
40-
41-
// Add package entries for angular packages
42-
ngPackageNames.forEach(function(pkgName) {
43-
44-
// Bundled (~40 requests):
45-
packages['@angular/'+pkgName] = { main: pkgName + '.umd.js', defaultExtension: 'js' };
46-
47-
// Individual files (~300 requests):
48-
//packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
49-
});
50-
51-
var config = {
52-
// DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER
53-
transpiler: 'ts',
54-
typescriptOptions: {
55-
tsconfig: true
56-
},
57-
meta: {
58-
'typescript': {
59-
"exports": "ts"
60-
}
61-
},
62-
map: map,
63-
packages: packages
64-
}
65-
66-
System.config(config);
67-
68-
})(this);
69-
70-
71-
/*
72-
Copyright 2016 Google Inc. All Rights Reserved.
73-
Use of this source code is governed by an MIT-style license that
74-
can be found in the LICENSE file at http://angular.io/license
75-
*/
5+
(function (global) {
6+
System.config({
7+
paths: {
8+
// paths serve as alias
9+
'npm:': 'node_modules/'
10+
},
11+
// map tells the System loader where to look for things
12+
map: {
13+
// our app is within the app folder
14+
app: 'app',
15+
16+
// angular bundles
17+
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
18+
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
19+
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
20+
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
21+
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
22+
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
23+
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
24+
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
25+
'@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',
26+
27+
// other libraries
28+
'rxjs': 'npm:rxjs',
29+
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
30+
},
31+
// packages tells the System loader how to load when no filename and/or no extension
32+
packages: {
33+
app: {
34+
main: './main.js',
35+
defaultExtension: 'js'
36+
},
37+
rxjs: {
38+
defaultExtension: 'js'
39+
}
40+
}
41+
});
42+
})(this);

0 commit comments

Comments
 (0)