Skip to content

Commit fadc266

Browse files
committed
updating to angular 2 rc1
1 parent 51c918a commit fadc266

18 files changed

+59
-57
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ This is a simple Angular 2 website using the brand new router. It demonstrates h
99

1010

1111
```bash
12-
git clone https://github.com/onehungrymind/fem-ng2-simple-app.git
13-
cd fem-ng2-simple-app
12+
git clone https://github.com/simpulton/angular2-website-routes.git
13+
cd angular2-website-routes
1414
npm i
15+
typings install
1516
npm start
1617
```
1718

18-
Then navigate your browser to [http://localhost:8080](http://localhost:8080) and use the app.
19+
Then navigate your browser to [http://localhost:3001](http://localhost:3001) and use the app.
1920

2021
## Testing
2122
The test setup includes `webpack.test.config.js`, `spec-bundle.js`, and `karma.conf.js`. To run unit tests, execute `npm test` in your terminal.

app/about/about.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import {Component, OnInit} from 'angular2/core';
1+
import {Component, OnInit} from '@angular/core';
22
import {StateService} from '../common/state.service';
33

44
@Component({
55
selector: 'about',
6-
templateUrl: 'app/about/about.component.html'
6+
template: require('./about.component.html')
77
})
88
export class AboutComponent implements OnInit{
99
title: string = 'About Page';

app/app.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ <h1 id="logo">
44
</h1>
55

66
<div id="menu">
7-
<a [routerLink]="['/Home']" class="btn">Home</a>
8-
<a [routerLink]="['/About']" class="btn">About</a>
9-
<a [routerLink]="['/Experiments']" class="btn">Experiments</a>
7+
<a [routerLink]="['/home']" class="btn">Home</a>
8+
<a [routerLink]="['/about']" class="btn">About</a>
9+
<a [routerLink]="['/experiments']" class="btn">Experiments</a>
1010
</div>
1111

1212
<div class="color"></div>

app/app.component.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {Component} from 'angular2/core';
2-
import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
1+
import {Component} from '@angular/core';
2+
import {Routes, ROUTER_DIRECTIVES} from '@angular/router';
33
import {AboutComponent} from './about/about.component';
44
import {ExperimentsComponent} from './experiments/experiments.component';
55
import {HomeComponent} from './home/home.component';
@@ -8,14 +8,14 @@ import {ExperimentsService} from './common/experiments.service';
88

99
@Component({
1010
selector: 'app',
11-
templateUrl: 'app/app.component.html',
12-
styleUrls: ['app/app.component.css'],
11+
template: require('./app.component.html'),
12+
styles: [require('./app.component.css')],
1313
directives: [ ROUTER_DIRECTIVES ],
1414
providers: [StateService, ExperimentsService],
1515
})
16-
@RouteConfig([
17-
{path: '/home', name: 'Home', component: HomeComponent, useAsDefault: true },
18-
{path: '/about', name: 'About', component: AboutComponent },
19-
{path: '/experiments', name: 'Experiments', component: ExperimentsComponent }
16+
@Routes([
17+
{path: '/home', component: HomeComponent },
18+
{path: '/about', component: AboutComponent },
19+
{path: '/experiments', component: ExperimentsComponent }
2020
])
2121
export class AppComponent {}

app/app.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect } from 'angular2/testing';
1+
import { describe, it, expect } from '@angular/core/testing';
22

33
import { AppComponent } from './app.component';
44

app/boot.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import 'core-js';
22
import 'zone.js/dist/zone';
33

4-
import {bootstrap} from 'angular2/platform/browser';
5-
import {ROUTER_PROVIDERS} from 'angular2/router';
4+
import {bootstrap} from '@angular/platform-browser-dynamic';
5+
import {ROUTER_PROVIDERS} from '@angular/router';
66
import {AppComponent} from './app.component';
77

88
bootstrap(AppComponent, [

app/common/experiments.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Injectable} from 'angular2/core';
1+
import {Injectable} from '@angular/core';
22
import {Experiment} from './experiment.model';
33

44
@Injectable()

app/common/state.service.ts

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

33
@Injectable()
44
export class StateService {

app/experiments/experiment-details/experiment.detail.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import {Component, Input} from 'angular2/core';
1+
import {Component, Input} from '@angular/core';
22
import {Experiment} from '../../common/experiment.model';
33

44
@Component({
55
selector: 'experiment',
6-
templateUrl: 'app/experiments/experiment-details/experiment.detail.component.html',
6+
template: require('./experiment.detail.component.html'),
77
styles: [`
88
.experiment {
99
cursor: pointer;

app/experiments/experiments.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ <h1>
55
{{ body }}
66
</p>
77
<hr/>
8-
<experiment *ngFor="#experiment of experiments" [experiment]="experiment"></experiment>
8+
<experiment *ngFor="let experiment of experiments" [experiment]="experiment"></experiment>
99
<hr/>
1010
<div>
1111
<h2 class="text-error">Experiments: {{message}}</h2>

app/experiments/experiments.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import {Component, OnInit} from 'angular2/core';
2-
import {NgFor} from 'angular2/common';
1+
import {Component, OnInit} from '@angular/core';
2+
import {NgFor} from '@angular/common';
33
import {Experiment} from '../common/experiment.model';
44
import {ExperimentsService} from '../common/experiments.service';
55
import {StateService} from '../common/state.service';
66
import {ExperimentDetailComponent} from './experiment-details/experiment.detail.component';
77

88
@Component({
99
selector: 'experiments',
10-
templateUrl: 'app/experiments/experiments.component.html',
10+
template: require('./experiments.component.html'),
1111
directives: [ExperimentDetailComponent]
1212
})
1313
export class ExperimentsComponent implements OnInit {

app/home/home.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import {
33
describe,
44
expect,
55
it
6-
} from 'angular2/testing';
6+
} from '@angular/core/testing';
77

88
import { HomeComponent } from './home.component';
99

1010
describe('Home Component', () => {
1111
it('should be named `HomeComponent`', () => {
12-
expect(HomeComponent.name).toBe('HomeComponent');
12+
expect(HomeComponent['name']).toBe('HomeComponent');
1313
});
1414

1515
it('should have a method called `updateMessage`', () => {

app/home/home.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import {Component, OnInit} from 'angular2/core';
1+
import {Component, OnInit} from '@angular/core';
22
import {StateService} from '../common/state.service';
33

44
@Component({
55
selector: 'home',
6-
templateUrl: 'app/home/home.component.html'
6+
template: require('./home.component.html')
77
})
88
export class HomeComponent implements OnInit {
99
title: string = 'Home Page';

package.json

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,38 @@
77
"url": "https://github.com/onehungrymind/fem-ng2-simple-app/"
88
},
99
"scripts": {
10-
"start": "webpack-dev-server --inline --watch",
11-
"test": "karma start",
12-
"postinstall": "typings install"
10+
"start": "webpack-dev-server --inline --colors --watch --display-error-details --display-cached --port 3001 --hot",
11+
"test": "karma start"
1312
},
1413
"dependencies": {
15-
"angular2": "^2.0.0-beta.13",
16-
"es6-promise": "^3.0.2",
14+
"@angular/common": "2.0.0-rc.1",
15+
"@angular/compiler": "2.0.0-rc.1",
16+
"@angular/core": "2.0.0-rc.1",
17+
"@angular/platform-browser": "2.0.0-rc.1",
18+
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
19+
"@angular/router": "^2.0.0-rc.1",
1720
"es6-shim": "^0.35.0",
18-
"reflect-metadata": "0.1.2",
19-
"rxjs": "5.0.0-beta.2",
20-
"systemjs": "^0.19.8",
21-
"zone.js": "^0.6.6"
21+
"reflect-metadata": "0.1.3",
22+
"rxjs": "5.0.0-beta.7",
23+
"systemjs": "^0.19.27",
24+
"zone.js": "^0.6.12"
2225
},
2326
"devDependencies": {
24-
"awesome-typescript-loader": "^0.16.0-rc.0",
25-
"core-js": "^2.2.0",
27+
"awesome-typescript-loader": "^0.17.0",
28+
"core-js": "^2.4.0",
2629
"jasmine-core": "^2.4.1",
2730
"karma": "^0.13.22",
28-
"karma-coverage": "^0.5.5",
29-
"karma-jasmine": "^0.3.7",
31+
"karma-coverage": "^1.0.0",
32+
"karma-jasmine": "^1.0.2",
3033
"karma-phantomjs-launcher": "^1.0.0",
3134
"karma-sourcemap-loader": "^0.3.7",
32-
"karma-spec-reporter": "0.0.24",
35+
"karma-spec-reporter": "0.0.26",
3336
"karma-webpack": "^1.7.0",
34-
"phantomjs-prebuilt": "^2.1.5",
37+
"phantomjs-prebuilt": "^2.1.7",
38+
"raw-loader": "^0.5.1",
3539
"source-map-loader": "^0.1.5",
36-
"typescript": "^1.7.3",
37-
"webpack": "^1.12.14",
40+
"typescript": "^1.8.10",
41+
"webpack": "^1.13.0",
3842
"webpack-dev-server": "^1.14.1"
3943
}
4044
}

spec-bundle.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
21
require('core-js');
3-
require('zone.js/dist/zone.js');
4-
// require('zone.js/dist/long-stack-trace-zone.js');
5-
require('zone.js/dist/jasmine-patch.js');
2+
require('zone.js');
63

74
var testContext = require.context('./app', true, /\.spec\.ts/);
85

typings.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{
2-
"dependencies": {
3-
"es6-promise": "github:typed-typings/npm-es6-promise#fb04188767acfec1defd054fc8024fafa5cd4de7"
4-
},
2+
"dependencies": {},
53
"devDependencies": {},
64
"ambientDependencies": {
75
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#6697d6f7dadbf5773cb40ecda35a76027e0783b2",

webpack.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ module.exports = {
2222
{ test: /\.js$/, loader: 'source-map-loader', exclude: [ root('node_modules/rxjs') ] }
2323
],
2424
loaders: [
25-
{ test: /\.ts$/, loader: 'awesome-typescript-loader', exclude: [ /\.(spec|e2e)\.ts$/ ] }
25+
{ test: /\.ts$/, loader: 'awesome-typescript-loader', exclude: [ /\.(spec|e2e)\.ts$/ ] },
26+
{ test: /\.(html|css)$/, loader: 'raw-loader' }
2627
]
2728
},
2829
devServer: {

webpack.test.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ module.exports = {
1717
module: {
1818
loaders: [
1919
{ test: /\.js$/, loader: "source-map-loader", exclude: [ root('node_modules/rxjs') ]},
20-
{ test: /\.ts$/, loader: 'awesome-typescript-loader' }
20+
{ test: /\.ts$/, loader: 'awesome-typescript-loader' },
21+
{ test: /\.(html|css)$/, loader: 'raw-loader' }
2122
]
2223
}
2324
};

0 commit comments

Comments
 (0)