Skip to content

Commit

Permalink
chore: adapt brickyard-cli@4.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-ng committed Sep 12, 2017
1 parent 7f8403f commit 80c24e7
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 76 deletions.
9 changes: 7 additions & 2 deletions brickyard_modules/tutorial/angular2/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { Component } from '@angular/core';
import { ngxModuleCollector } from '@brickyard/ngx-module-collector'

@Component({
selector: 'brickyard-app',
template: `
<h1>{{title}}</h1>
<nav>
<a routerLink="/dashboard" routerLinkActive="active">Dashboard</a>
<a routerLink="/heroes" routerLinkActive="active">Heroes</a>
<a routerLink="dashboard" routerLinkActive="active">Dashboard</a>
<a routerLink="heroes" routerLinkActive="active">Heroes</a>
</nav>
<router-outlet></router-outlet>
`,
Expand All @@ -14,3 +16,6 @@ import { Component } from '@angular/core';
export class AppComponent {
title = 'Tour of Heroes';
}

ngxModuleCollector.registerNgModuleDeclarations(AppComponent)
ngxModuleCollector.registerNgModuleBootstrap(AppComponent)
58 changes: 0 additions & 58 deletions brickyard_modules/tutorial/angular2/app/app.module.ts

This file was deleted.

33 changes: 28 additions & 5 deletions brickyard_modules/tutorial/angular2/app/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
import 'brickyard/angular2-common'
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
import { AppModule } from './app.module'
const platform = platformBrowserDynamic()
platform.bootstrapModule(AppModule)
import { RouterModule } from '@angular/router';
import { ngxModuleCollector } from '@brickyard/ngx-module-collector'
import { DashboardComponent } from '@brickyard/tutorial-angular2-dashboard'
import { HeroDetailComponent } from '@brickyard/tutorial-angular2-hero-detail'
import { HeroesComponent } from '@brickyard/tutorial-angular2-heroes'
import './app.component'

ngxModuleCollector.registerNgModuleImports(
RouterModule.forRoot([
{
path: '',
redirectTo: 'dashboard',
pathMatch: 'full'
},
{
path: 'dashboard',
component: DashboardComponent
},
{
path: 'detail/:id',
component: HeroDetailComponent
},
{
path: 'heroes',
component: HeroesComponent
}
])
)
18 changes: 9 additions & 9 deletions brickyard_modules/tutorial/angular2/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
"author": "brickyard-developer",
"license": "ISC",
"devDependencies": {
"@angular/common": "^4.3.5",
"@angular/compiler": "^4.3.5",
"@angular/core": "^4.3.5",
"@angular/forms": "^4.3.5",
"@angular/http": "^4.3.5",
"@angular/platform-browser": "^4.3.5",
"@angular/platform-browser-dynamic": "^4.3.5",
"@angular/router": "^4.3.5",
"angular-in-memory-web-api": "^0.3.2",
"@angular/common": "^4.4.0-RC.0",
"@angular/compiler": "^4.4.0-RC.0",
"@angular/core": "^4.4.0-RC.0",
"@angular/forms": "^4.4.0-RC.0",
"@angular/http": "^4.4.0-RC.0",
"@angular/platform-browser": "^4.4.0-RC.0",
"@angular/platform-browser-dynamic": "^4.4.0-RC.0",
"@angular/router": "^4.4.0-RC.0",
"angular-in-memory-web-api": "^0.4.2",
"bootstrap": "^3.3.7"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Hero, HeroService } from 'brickyard/tutorial-angular2-model';
import { ngxModuleCollector } from '@brickyard/ngx-module-collector';

@Component({
selector: 'my-dashboard',
Expand All @@ -23,3 +24,5 @@ export class DashboardComponent implements OnInit {
this.router.navigate(link);
}
}

ngxModuleCollector.registerNgModuleDeclarations(DashboardComponent)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { Location } from '@angular/common';
import { Hero, HeroService } from 'brickyard/tutorial-angular2-model';
import { ngxModuleCollector } from '@brickyard/ngx-module-collector';

@Component({
selector: 'my-hero-detail',
templateUrl: './hero-detail.component.html',
Expand Down Expand Up @@ -29,3 +31,5 @@ export class HeroDetailComponent implements OnInit {
this.location.back();
}
}

ngxModuleCollector.registerNgModuleDeclarations(HeroDetailComponent)
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject';
import { HeroSearchService } from './hero-search.service';
import { Hero } from 'brickyard/tutorial-angular2-model';
import { ngxModuleCollector } from '@brickyard/ngx-module-collector';

@Component({
selector: 'hero-search',
templateUrl: './hero-search.component.html',
Expand Down Expand Up @@ -40,3 +42,5 @@ export class HeroSearchComponent implements OnInit {
this.router.navigate(link);
}
}

ngxModuleCollector.registerNgModuleDeclarations(HeroSearchComponent)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import { Observable } from 'rxjs';
import { Hero } from 'brickyard/tutorial-angular2-model';;
import { Hero } from 'brickyard/tutorial-angular2-model';
@Injectable()
export class HeroSearchService {
constructor(private http: Http) {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Hero, HeroService } from 'brickyard/tutorial-angular2-model';
import { ngxModuleCollector }from '@brickyard/ngx-module-collector';

@Component({
selector: 'my-heroes',
templateUrl: './heroes.component.html',
Expand Down Expand Up @@ -44,3 +46,5 @@ export class HeroesComponent implements OnInit {
this.router.navigate(['/detail', this.selectedHero.id]);
}
}

ngxModuleCollector.registerNgModuleDeclarations(HeroesComponent)
7 changes: 6 additions & 1 deletion brickyard_modules/tutorial/angular2/model/hero.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Injectable } from '@angular/core';
import { Headers, Http } from '@angular/http';
import { HttpModule, Headers, Http } from '@angular/http';
import 'rxjs/add/operator/toPromise';
import { Hero } from './hero';
import { ngxModuleCollector }from '@brickyard/ngx-module-collector';

@Injectable()
export class HeroService {
private headers = new Headers({'Content-Type': 'application/json'});
Expand Down Expand Up @@ -44,3 +46,6 @@ export class HeroService {
return Promise.reject(error.message || error);
}
}

ngxModuleCollector.registerNgModuleImports(HttpModule)
ngxModuleCollector.registerNgModuleProviders(HeroService)
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { InMemoryDbService } from 'angular-in-memory-web-api';
import { InMemoryWebApiModule } from 'angular-in-memory-web-api';
import { ngxModuleCollector }from '@brickyard/ngx-module-collector';

export class InMemoryDataService implements InMemoryDbService {
createDb() {
let heroes = [
Expand All @@ -16,3 +19,5 @@ export class InMemoryDataService implements InMemoryDbService {
return {heroes};
}
}

ngxModuleCollector.registerNgModuleImports(InMemoryWebApiModule.forRoot(InMemoryDataService))

0 comments on commit 80c24e7

Please sign in to comment.