Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 4ec9276

Browse files
nadavsinaiPatrickJS
authored andcommitted
chore: upgrade to rc5 (#115)
* (chore) upgrade to rc5 - update dependencies - add appModule, - fix bootstrap - remove boilerplate from inner components * reformat by pr comments, also better formatting for routes
1 parent 1e9782f commit 4ec9276

File tree

10 files changed

+62
-66
lines changed

10 files changed

+62
-66
lines changed

package.json

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,17 @@
2828
"webpack-merge": "^0.8.4"
2929
},
3030
"dependencies": {
31-
"@angular/common": "2.0.0-rc.4",
32-
"@angular/compiler": "2.0.0-rc.4",
33-
"@angular/core": "2.0.0-rc.4",
34-
"@angular/http": "2.0.0-rc.4",
35-
"@angular/platform-browser": "2.0.0-rc.4",
36-
"@angular/platform-browser-dynamic": "2.0.0-rc.4",
37-
"@angular/router": "3.0.0-beta.2",
31+
"@angular/common": "2.0.0-rc.5",
32+
"@angular/compiler": "2.0.0-rc.5",
33+
"@angular/core": "2.0.0-rc.5",
34+
"@angular/http": "2.0.0-rc.5",
35+
"@angular/compiler-cli": "0.5.0",
36+
"@angular/platform-server": "2.0.0-rc.5",
37+
"@angular/forms": "0.3.0",
38+
"@angular/platform-browser": "2.0.0-rc.5",
39+
"typescript": "^1.9.0-dev",
40+
"@angular/platform-browser-dynamic": "2.0.0-rc.5",
41+
"@angular/router": "3.0.0-rc.1",
3842
"core-js": "^2.2.0",
3943
"ie-shim": "^0.1.0",
4044
"rxjs": "5.0.0-beta.6",

src/app/about/about.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ import {Component} from '@angular/core';
22

33
@Component({
44
selector: 'about',
5-
pipes: [],
6-
providers: [],
7-
directives: [],
85
styleUrls: ['./about.css'],
96
templateUrl: './about.html'
107
})

src/app/app.module.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import {NgModule} from '@angular/core'
2+
import {RouterModule} from "@angular/router";
3+
import {rootRouterConfig} from "./app.routes";
4+
import {AppComponent} from "./app";
5+
import {Github} from "./github/shared/github";
6+
import {FormsModule} from "@angular/forms";
7+
import {BrowserModule} from "@angular/platform-browser";
8+
import {HttpModule} from "@angular/http";
9+
import {About} from './about/about';
10+
import {Home} from './home/home';
11+
import {RepoBrowser} from './github/repo-browser/repo-browser';
12+
import {RepoList} from './github/repo-list/repo-list';
13+
import {RepoDetail} from './github/repo-detail/repo-detail';
14+
import {LocationStrategy, HashLocationStrategy} from '@angular/common';
15+
16+
@NgModule({
17+
declarations: [AppComponent, About, RepoBrowser, RepoList, RepoDetail, Home],
18+
imports : [BrowserModule, FormsModule, HttpModule, RouterModule.forRoot(rootRouterConfig)],
19+
providers : [Github, {provide: LocationStrategy, useClass: HashLocationStrategy}],
20+
bootstrap : [AppComponent]
21+
})
22+
export class AppModule {
23+
24+
}

src/app/app.routes.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
import { provideRouter, RouterConfig } from '@angular/router';
2-
1+
import {Routes} from '@angular/router';
32
import {About} from './about/about';
43
import {Home} from './home/home';
54
import {RepoBrowser} from './github/repo-browser/repo-browser';
65
import {RepoList} from './github/repo-list/repo-list';
76
import {RepoDetail} from './github/repo-detail/repo-detail';
87

9-
const routes: RouterConfig = [
10-
{ path: '', redirectTo: 'home', terminal: true },
11-
{ path: 'home', component: Home },
12-
{ path: 'about', component: About },
13-
{ path: 'github', component: RepoBrowser, children: [
14-
{ path: ':org', component: RepoList, children: [
15-
{ path: ':repo', component: RepoDetail },
16-
{ path: '', component: RepoDetail }
17-
]},
18-
{ path: '', component: RepoList}
19-
]}
8+
export const rootRouterConfig: Routes = [
9+
{path: '', redirectTo: 'home', terminal: true},
10+
{path: 'home', component: Home},
11+
{path: 'about', component: About},
12+
{path: 'github', component: RepoBrowser,
13+
children: [
14+
{path: '', component: RepoList},
15+
{path: ':org', component: RepoList,
16+
children: [
17+
{path: '', component: RepoDetail},
18+
{path: ':repo', component: RepoDetail}
19+
]
20+
}]
21+
}
2022
];
2123

22-
export const APP_ROUTER_PROVIDERS = [
23-
provideRouter(routes)
24-
];

src/app/app.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
import { Component } from '@angular/core';
2-
import { ROUTER_DIRECTIVES } from '@angular/router';
1+
import {Component} from '@angular/core';
32

43
@Component({
5-
selector: 'app',
6-
pipes: [],
7-
providers: [],
8-
directives: [ ROUTER_DIRECTIVES ],
4+
selector : 'app',
95
templateUrl: './app.html',
106
})
11-
export class App {
12-
constructor() {}
13-
7+
export class AppComponent {
148
}

src/app/github/repo-browser/repo-browser.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
import { Component } from '@angular/core';
2-
import { Router, ROUTER_DIRECTIVES } from '@angular/router';
2+
import { Router } from '@angular/router';
33
import { Github } from '../shared/github';
44

55
@Component({
66
selector: 'repo-browser',
7-
pipes: [],
8-
providers: [ Github ],
9-
directives: [ ROUTER_DIRECTIVES ],
107
templateUrl: './repo-browser.html',
118
styleUrls: ['./repo-browser.css']
129
})
1310
export class RepoBrowser {
1411

15-
constructor(private router: Router, private github: Github) {}
12+
constructor(private router: Router, private github: Github) {
13+
}
1614

1715
searchForOrg(orgName: string) {
1816
this.github.getOrg(orgName)

src/app/github/repo-detail/repo-detail.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import {Component, OnInit} from '@angular/core';
2-
import {ROUTER_DIRECTIVES, ActivatedRoute, Router} from '@angular/router';
2+
import {ActivatedRoute, Router} from '@angular/router';
33
import {Github} from '../shared/github';
44

55
@Component({
66
selector: 'repo-detail',
7-
pipes: [],
8-
providers: [],
9-
directives: [ROUTER_DIRECTIVES],
107
styleUrls: ['./repo-detail.css'],
118
templateUrl: './repo-detail.html'
129
})

src/app/github/repo-list/repo-list.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import {Component, OnInit} from '@angular/core';
22
import {Github} from '../shared/github';
33
import {Observable} from 'rxjs/Observable';
4-
import {ROUTER_DIRECTIVES, ActivatedRoute} from '@angular/router';
4+
import {ActivatedRoute} from '@angular/router';
55

66
@Component({
77
selector: 'repo-list',
8-
pipes: [],
9-
providers: [],
10-
directives: [ ROUTER_DIRECTIVES ],
118
styleUrls: ['./repo-list.css'],
129
templateUrl: './repo-list.html',
1310
})

src/app/home/home.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ import {Component} from '@angular/core';
22

33
@Component({
44
selector: 'home',
5-
pipes: [],
6-
providers: [],
7-
directives: [],
85
styleUrls: ['./home.css'],
96
templateUrl: './home.html'
107
})

src/main.browser.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
import {LocationStrategy, HashLocationStrategy} from '@angular/common';
2-
import {bootstrap} from '@angular/platform-browser-dynamic';
3-
import {HTTP_PROVIDERS} from '@angular/http';
4-
// import {enableProdMode} from '@angular/core';
1+
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
2+
import {AppModule} from './app/app.module';
53

6-
import {APP_ROUTER_PROVIDERS} from './app/app.routes';
7-
import {App} from './app/app';
8-
9-
// enableProdMode()
10-
11-
bootstrap(App, [
12-
HTTP_PROVIDERS,
13-
APP_ROUTER_PROVIDERS,
14-
{ provide: LocationStrategy, useClass: HashLocationStrategy }
15-
])
16-
.catch(err => console.error(err));
4+
platformBrowserDynamic().bootstrapModule(AppModule)
5+
.catch(err => console.error(err));

0 commit comments

Comments
 (0)