messing with heroes app

master
Matt Huntington 9 years ago
parent 0d73dfb45d
commit 6decc50aac

@ -7,15 +7,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core"); var core_1 = require("@angular/core");
var router_1 = require("@angular/router");
var dashboard_component_1 = require("./dashboard.component"); var dashboard_component_1 = require("./dashboard.component");
var heroes_component_1 = require("./heroes.component");
var hero_detail_component_1 = require("./hero-detail.component"); var hero_detail_component_1 = require("./hero-detail.component");
var routes = [ var routes = [
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
{ path: 'dashboard', component: dashboard_component_1.DashboardComponent }, { path: 'dashboard', component: dashboard_component_1.DashboardComponent },
{ path: 'detail/:id', component: hero_detail_component_1.HeroDetailComponent }, { path: 'detail/:id', component: hero_detail_component_1.HeroDetailComponent },
{ path: 'heroes', component: heroes_component_1.HeroesComponent } { path: 'heroes', component: HeroesComponent }
]; ];
var AppRoutingModule = (function () { var AppRoutingModule = (function () {
function AppRoutingModule() { function AppRoutingModule() {
@ -24,8 +21,8 @@ var AppRoutingModule = (function () {
}()); }());
AppRoutingModule = __decorate([ AppRoutingModule = __decorate([
core_1.NgModule({ core_1.NgModule({
imports: [router_1.RouterModule.forRoot(routes)], imports: [RouterModule.forRoot(routes)],
exports: [router_1.RouterModule] exports: [RouterModule]
}) })
], AppRoutingModule); ], AppRoutingModule);
exports.AppRoutingModule = AppRoutingModule; exports.AppRoutingModule = AppRoutingModule;

@ -1 +1 @@
{"version":3,"file":"app-routing.module.js","sourceRoot":"","sources":["app-routing.module.ts"],"names":[],"mappings":";;;;;;;;AAAA,sCAAqD;AACrD,0CAAuD;AAEvD,6DAA6D;AAC7D,uDAA0D;AAC1D,iEAA+D;AAE/D,IAAM,MAAM,GAAW;IACrB,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE;IACzD,EAAE,IAAI,EAAE,WAAW,EAAG,SAAS,EAAE,wCAAkB,EAAE;IACrD,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,2CAAmB,EAAE;IACtD,EAAE,IAAI,EAAE,QAAQ,EAAM,SAAS,EAAE,kCAAe,EAAE;CACnD,CAAC;AAMF,IAAa,gBAAgB;IAA7B;IAA+B,CAAC;IAAD,uBAAC;AAAD,CAAC,AAAhC,IAAgC;AAAnB,gBAAgB;IAJ5B,eAAQ,CAAC;QACR,OAAO,EAAE,CAAE,qBAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAE;QACzC,OAAO,EAAE,CAAE,qBAAY,CAAE;KAC1B,CAAC;GACW,gBAAgB,CAAG;AAAnB,4CAAgB"} {"version":3,"file":"app-routing.module.js","sourceRoot":"","sources":["app-routing.module.ts"],"names":[],"mappings":";;;;;;;;AAAA,sCAAqD;AAErD,6DAA6D;AAC7D,iEAA+D;AAE/D,IAAM,MAAM,GAAW;IACrB,EAAE,IAAI,EAAE,WAAW,EAAG,SAAS,EAAE,wCAAkB,EAAE;IACrD,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,2CAAmB,EAAE;IACtD,EAAE,IAAI,EAAE,QAAQ,EAAM,SAAS,EAAE,eAAe,EAAE;CACnD,CAAC;AAMF,IAAa,gBAAgB;IAA7B;IAA+B,CAAC;IAAD,uBAAC;AAAD,CAAC,AAAhC,IAAgC;AAAnB,gBAAgB;IAJ5B,eAAQ,CAAC;QACR,OAAO,EAAE,CAAE,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAE;QACzC,OAAO,EAAE,CAAE,YAAY,CAAE;KAC1B,CAAC;GACW,gBAAgB,CAAG;AAAnB,4CAAgB"}

@ -1,12 +1,9 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { DashboardComponent } from './dashboard.component'; import { DashboardComponent } from './dashboard.component';
import { HeroesComponent } from './heroes.component';
import { HeroDetailComponent } from './hero-detail.component'; import { HeroDetailComponent } from './hero-detail.component';
const routes: Routes = [ const routes: Routes = [
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
{ path: 'dashboard', component: DashboardComponent }, { path: 'dashboard', component: DashboardComponent },
{ path: 'detail/:id', component: HeroDetailComponent }, { path: 'detail/:id', component: HeroDetailComponent },
{ path: 'heroes', component: HeroesComponent } { path: 'heroes', component: HeroesComponent }

@ -16,7 +16,7 @@ var AppComponent = (function () {
AppComponent = __decorate([ AppComponent = __decorate([
core_1.Component({ core_1.Component({
selector: 'my-app', selector: 'my-app',
template: "\n <h1>{{title}}</h1>\n <nav>\n <a routerLink=\"/dashboard\" routerLinkActive=\"active\">Dashboard</a>\n <a routerLink=\"/heroes\" routerLinkActive=\"active\">Heroes</a>\n </nav>\n <router-outlet></router-outlet>\n ", template: "\n <nav>\n <a routerLink=\"/dashboard\" routerLinkActive=\"active\">Dashboard</a>\n <a routerLink=\"/heroes\" routerLinkActive=\"active\">Heroes</a>\n </nav>\n <router-outlet></router-outlet>\n ",
styleUrls: ['./app.component.css'], styleUrls: ['./app.component.css'],
}) })
], AppComponent); ], AppComponent);

@ -1 +1 @@
{"version":3,"file":"app.component.js","sourceRoot":"","sources":["app.component.ts"],"names":[],"mappings":";;;;;;;;AAAA,sCAA0C;AAc1C,IAAa,YAAY;IAZzB;QAaE,UAAK,GAAG,gBAAgB,CAAC;IAC3B,CAAC;IAAD,mBAAC;AAAD,CAAC,AAFD,IAEC;AAFY,YAAY;IAZxB,gBAAS,CAAC;QACT,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,gPAOT;QACD,SAAS,EAAE,CAAC,qBAAqB,CAAC;KACnC,CAAC;GACW,YAAY,CAExB;AAFY,oCAAY"} {"version":3,"file":"app.component.js","sourceRoot":"","sources":["app.component.ts"],"names":[],"mappings":";;;;;;;;AAAA,sCAA0C;AAa1C,IAAa,YAAY;IAXzB;QAYE,UAAK,GAAG,gBAAgB,CAAC;IAC3B,CAAC;IAAD,mBAAC;AAAD,CAAC,AAFD,IAEC;AAFY,YAAY;IAXxB,gBAAS,CAAC;QACT,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,wNAMT;QACD,SAAS,EAAE,CAAC,qBAAqB,CAAC;KACnC,CAAC;GACW,YAAY,CAExB;AAFY,oCAAY"}

@ -3,7 +3,6 @@ import { Component } from '@angular/core';
@Component({ @Component({
selector: 'my-app', selector: 'my-app',
template: ` template: `
<h1>{{title}}</h1>
<nav> <nav>
<a routerLink="/dashboard" routerLinkActive="active">Dashboard</a> <a routerLink="/dashboard" routerLinkActive="active">Dashboard</a>
<a routerLink="/heroes" routerLinkActive="active">Heroes</a> <a routerLink="/heroes" routerLinkActive="active">Heroes</a>

@ -8,7 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core"); var core_1 = require("@angular/core");
var platform_browser_1 = require("@angular/platform-browser"); var platform_browser_1 = require("@angular/platform-browser");
var forms_1 = require("@angular/forms");
var app_component_1 = require("./app.component"); var app_component_1 = require("./app.component");
var dashboard_component_1 = require("./dashboard.component"); var dashboard_component_1 = require("./dashboard.component");
var hero_detail_component_1 = require("./hero-detail.component"); var hero_detail_component_1 = require("./hero-detail.component");
@ -24,7 +23,6 @@ AppModule = __decorate([
core_1.NgModule({ core_1.NgModule({
imports: [ imports: [
platform_browser_1.BrowserModule, platform_browser_1.BrowserModule,
forms_1.FormsModule,
app_routing_module_1.AppRoutingModule app_routing_module_1.AppRoutingModule
], ],
declarations: [ declarations: [

@ -1 +1 @@
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["app.module.ts"],"names":[],"mappings":";;;;;;;;AAAA,sCAA+C;AAC/C,8DAA2D;AAC3D,wCAAgD;AAEhD,iDAAuD;AACvD,6DAA6D;AAC7D,iEAA+D;AAC/D,uDAA0D;AAC1D,+CAAsD;AAEtD,2DAA4D;AAiB5D,IAAa,SAAS;IAAtB;IAAyB,CAAC;IAAD,gBAAC;AAAD,CAAC,AAA1B,IAA0B;AAAb,SAAS;IAfrB,eAAQ,CAAC;QACR,OAAO,EAAE;YACP,gCAAa;YACb,mBAAW;YACX,qCAAgB;SACjB;QACD,YAAY,EAAE;YACZ,4BAAY;YACZ,wCAAkB;YAClB,2CAAmB;YACnB,kCAAe;SAChB;QACD,SAAS,EAAE,CAAE,0BAAW,CAAE;QAC1B,SAAS,EAAE,CAAE,4BAAY,CAAE;KAC5B,CAAC;GACW,SAAS,CAAI;AAAb,8BAAS"} {"version":3,"file":"app.module.js","sourceRoot":"","sources":["app.module.ts"],"names":[],"mappings":";;;;;;;;AAAA,sCAA+C;AAC/C,8DAA2D;AAG3D,iDAAuD;AACvD,6DAA6D;AAC7D,iEAA+D;AAC/D,uDAA0D;AAC1D,+CAAsD;AAEtD,2DAA4D;AAgB5D,IAAa,SAAS;IAAtB;IAAyB,CAAC;IAAD,gBAAC;AAAD,CAAC,AAA1B,IAA0B;AAAb,SAAS;IAdrB,eAAQ,CAAC;QACR,OAAO,EAAE;YACP,gCAAa;YACb,qCAAgB;SACjB;QACD,YAAY,EAAE;YACZ,4BAAY;YACZ,wCAAkB;YAClB,2CAAmB;YACnB,kCAAe;SAChB;QACD,SAAS,EAAE,CAAE,0BAAW,CAAE;QAC1B,SAAS,EAAE,CAAE,4BAAY,CAAE;KAC5B,CAAC;GACW,SAAS,CAAI;AAAb,8BAAS"}

@ -13,7 +13,6 @@ import { AppRoutingModule } from './app-routing.module';
@NgModule({ @NgModule({
imports: [ imports: [
BrowserModule, BrowserModule,
FormsModule,
AppRoutingModule AppRoutingModule
], ],
declarations: [ declarations: [

@ -2,7 +2,6 @@
<div class="grid grid-pad"> <div class="grid grid-pad">
<a *ngFor="let hero of heroes" [routerLink]="['/detail', hero.id]" class="col-1-4"> <a *ngFor="let hero of heroes" [routerLink]="['/detail', hero.id]" class="col-1-4">
<div class="module hero"> <div class="module hero">
<h4>{{hero.name}}</h4>
</div> </div>
</a> </a>
</div> </div>

@ -14,12 +14,8 @@ var hero_service_1 = require("./hero.service");
var DashboardComponent = (function () { var DashboardComponent = (function () {
function DashboardComponent(heroService) { function DashboardComponent(heroService) {
this.heroService = heroService; this.heroService = heroService;
this.heroes = [];
} }
DashboardComponent.prototype.ngOnInit = function () { DashboardComponent.prototype.ngOnInit = function () {
var _this = this;
this.heroService.getHeroes()
.then(function (heroes) { return _this.heroes = heroes.slice(1, 5); });
}; };
return DashboardComponent; return DashboardComponent;
}()); }());

@ -1 +1 @@
{"version":3,"file":"dashboard.component.js","sourceRoot":"","sources":["dashboard.component.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAAkD;AAGlD,+CAA6C;AAO7C,IAAa,kBAAkB;IAI7B,4BAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;QAF5C,WAAM,GAAW,EAAE,CAAC;IAE4B,CAAC;IAEjD,qCAAQ,GAAR;QAAA,iBAGC;QAFC,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE;aACzB,IAAI,CAAC,UAAA,MAAM,IAAI,OAAA,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAhC,CAAgC,CAAC,CAAC;IACtD,CAAC;IACH,yBAAC;AAAD,CAAC,AAVD,IAUC;AAVY,kBAAkB;IAL9B,gBAAS,CAAC;QACT,QAAQ,EAAE,cAAc;QACxB,WAAW,EAAE,4BAA4B;QACzC,SAAS,EAAE,CAAE,2BAA2B,CAAE;KAC3C,CAAC;qCAKiC,0BAAW;GAJjC,kBAAkB,CAU9B;AAVY,gDAAkB"} {"version":3,"file":"dashboard.component.js","sourceRoot":"","sources":["dashboard.component.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAAkD;AAGlD,+CAA6C;AAO7C,IAAa,kBAAkB;IAE7B,4BAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAI,CAAC;IAEjD,qCAAQ,GAAR;IACA,CAAC;IACH,yBAAC;AAAD,CAAC,AAND,IAMC;AANY,kBAAkB;IAL9B,gBAAS,CAAC;QACT,QAAQ,EAAE,cAAc;QACxB,WAAW,EAAE,4BAA4B;QACzC,SAAS,EAAE,CAAE,2BAA2B,CAAE;KAC3C,CAAC;qCAGiC,0BAAW;GAFjC,kBAAkB,CAM9B;AANY,gDAAkB"}

@ -10,12 +10,8 @@ import { HeroService } from './hero.service';
}) })
export class DashboardComponent implements OnInit { export class DashboardComponent implements OnInit {
heroes: Hero[] = [];
constructor(private heroService: HeroService) { } constructor(private heroService: HeroService) { }
ngOnInit(): void { ngOnInit(): void {
this.heroService.getHeroes()
.then(heroes => this.heroes = heroes.slice(1, 5));
} }
} }

@ -4,7 +4,6 @@
<label>id: </label>{{hero.id}}</div> <label>id: </label>{{hero.id}}</div>
<div> <div>
<label>name: </label> <label>name: </label>
<input [(ngModel)]="hero.name" placeholder="name" />
</div> </div>
<button (click)="goBack()">Back</button> <button (click)="goBack()">Back</button>
</div> </div>

@ -11,13 +11,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
require("rxjs/add/operator/switchMap"); require("rxjs/add/operator/switchMap");
var core_1 = require("@angular/core"); var core_1 = require("@angular/core");
var router_1 = require("@angular/router");
var common_1 = require("@angular/common"); var common_1 = require("@angular/common");
var hero_service_1 = require("./hero.service"); var hero_service_1 = require("./hero.service");
var HeroDetailComponent = (function () { var HeroDetailComponent = (function () {
function HeroDetailComponent(heroService, route, location) { function HeroDetailComponent(heroService, location) {
this.heroService = heroService; this.heroService = heroService;
this.route = route;
this.location = location; this.location = location;
} }
HeroDetailComponent.prototype.ngOnInit = function () { HeroDetailComponent.prototype.ngOnInit = function () {
@ -33,12 +31,10 @@ var HeroDetailComponent = (function () {
}()); }());
HeroDetailComponent = __decorate([ HeroDetailComponent = __decorate([
core_1.Component({ core_1.Component({
selector: 'hero-detail',
templateUrl: './hero-detail.component.html', templateUrl: './hero-detail.component.html',
styleUrls: ['./hero-detail.component.css'] styleUrls: ['./hero-detail.component.css']
}), }),
__metadata("design:paramtypes", [hero_service_1.HeroService, __metadata("design:paramtypes", [hero_service_1.HeroService,
router_1.ActivatedRoute,
common_1.Location]) common_1.Location])
], HeroDetailComponent); ], HeroDetailComponent);
exports.HeroDetailComponent = HeroDetailComponent; exports.HeroDetailComponent = HeroDetailComponent;

@ -1 +1 @@
{"version":3,"file":"hero-detail.component.js","sourceRoot":"","sources":["hero-detail.component.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uCAAqC;AACrC,sCAAyD;AACzD,0CAA2D;AAC3D,0CAA2D;AAG3D,+CAA8C;AAM9C,IAAa,mBAAmB;IAG9B,6BACU,WAAwB,EACxB,KAAqB,EACrB,QAAkB;QAFlB,gBAAW,GAAX,WAAW,CAAa;QACxB,UAAK,GAAL,KAAK,CAAgB;QACrB,aAAQ,GAAR,QAAQ,CAAU;IACzB,CAAC;IAEJ,sCAAQ,GAAR;QAAA,iBAIC;QAHC,IAAI,CAAC,KAAK,CAAC,QAAQ;aAChB,SAAS,CAAC,UAAC,MAAgB,IAAK,OAAA,KAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAA3C,CAA2C,CAAC;aAC5E,SAAS,CAAC,UAAA,IAAI,IAAI,OAAA,KAAI,CAAC,IAAI,GAAG,IAAI,EAAhB,CAAgB,CAAC,CAAC;IACzC,CAAC;IAED,oCAAM,GAAN;QACE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC;IACH,0BAAC;AAAD,CAAC,AAlBD,IAkBC;AAlBY,mBAAmB;IAL/B,gBAAS,CAAC;QACT,QAAQ,EAAE,aAAa;QACvB,WAAW,EAAE,8BAA8B;QAC3C,SAAS,EAAE,CAAE,6BAA6B,CAAE;KAC7C,CAAC;qCAKuB,0BAAW;QACjB,uBAAc;QACX,iBAAQ;GANjB,mBAAmB,CAkB/B;AAlBY,kDAAmB"} {"version":3,"file":"hero-detail.component.js","sourceRoot":"","sources":["hero-detail.component.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uCAAqC;AACrC,sCAAyD;AAEzD,0CAA2D;AAG3D,+CAA8C;AAK9C,IAAa,mBAAmB;IAG9B,6BACU,WAAwB,EACxB,QAAkB;QADlB,gBAAW,GAAX,WAAW,CAAa;QACxB,aAAQ,GAAR,QAAQ,CAAU;IACzB,CAAC;IAEJ,sCAAQ,GAAR;QAAA,iBAIC;QAHC,IAAI,CAAC,KAAK,CAAC,QAAQ;aAChB,SAAS,CAAC,UAAC,MAAgB,IAAK,OAAA,KAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAA3C,CAA2C,CAAC;aAC5E,SAAS,CAAC,UAAA,IAAI,IAAI,OAAA,KAAI,CAAC,IAAI,GAAG,IAAI,EAAhB,CAAgB,CAAC,CAAC;IACzC,CAAC;IAED,oCAAM,GAAN;QACE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC;IACH,0BAAC;AAAD,CAAC,AAjBD,IAiBC;AAjBY,mBAAmB;IAJ/B,gBAAS,CAAC;QACT,WAAW,EAAE,8BAA8B;QAC3C,SAAS,EAAE,CAAE,6BAA6B,CAAE;KAC7C,CAAC;qCAKuB,0BAAW;QACd,iBAAQ;GALjB,mBAAmB,CAiB/B;AAjBY,kDAAmB"}

@ -6,7 +6,6 @@ import { Location } from '@angular/common';
import { Hero } from './hero'; import { Hero } from './hero';
import { HeroService } from './hero.service'; import { HeroService } from './hero.service';
@Component({ @Component({
selector: 'hero-detail',
templateUrl: './hero-detail.component.html', templateUrl: './hero-detail.component.html',
styleUrls: [ './hero-detail.component.css' ] styleUrls: [ './hero-detail.component.css' ]
}) })
@ -15,7 +14,6 @@ export class HeroDetailComponent implements OnInit {
constructor( constructor(
private heroService: HeroService, private heroService: HeroService,
private route: ActivatedRoute,
private location: Location private location: Location
) {} ) {}

@ -6,13 +6,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
return c > 3 && r && Object.defineProperty(target, key, r), r; return c > 3 && r && Object.defineProperty(target, key, r), r;
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var mock_heroes_1 = require("./mock-heroes");
var core_1 = require("@angular/core"); var core_1 = require("@angular/core");
var HeroService = (function () { var HeroService = (function () {
function HeroService() { function HeroService() {
} }
HeroService.prototype.getHeroes = function () { HeroService.prototype.getHeroes = function () {
return Promise.resolve(mock_heroes_1.HEROES); return Promise.resolve(HEROES);
}; };
HeroService.prototype.getHeroesSlowly = function () { HeroService.prototype.getHeroesSlowly = function () {
var _this = this; var _this = this;

@ -1 +1 @@
{"version":3,"file":"hero.service.js","sourceRoot":"","sources":["hero.service.ts"],"names":[],"mappings":";;;;;;;;AACA,6CAAuC;AACvC,sCAA2C;AAG3C,IAAa,WAAW;IAAxB;IAgBA,CAAC;IAfC,+BAAS,GAAT;QACE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,oBAAM,CAAC,CAAC;IACjC,CAAC;IAED,qCAAe,GAAf;QAAA,iBAKC;QAJC,MAAM,CAAC,IAAI,OAAO,CAAC,UAAA,OAAO;YACxB,8CAA8C;YAC9C,UAAU,CAAC,cAAM,OAAA,OAAO,CAAC,KAAI,CAAC,SAAS,EAAE,CAAC,EAAzB,CAAyB,EAAE,IAAI,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,6BAAO,GAAP,UAAQ,EAAU;QAChB,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE;aACX,IAAI,CAAC,UAAA,MAAM,IAAI,OAAA,MAAM,CAAC,IAAI,CAAC,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,EAAE,KAAK,EAAE,EAAd,CAAc,CAAC,EAAnC,CAAmC,CAAC,CAAC;IAClE,CAAC;IACH,kBAAC;AAAD,CAAC,AAhBD,IAgBC;AAhBY,WAAW;IADvB,iBAAU,EAAE;GACA,WAAW,CAgBvB;AAhBY,kCAAW"} {"version":3,"file":"hero.service.js","sourceRoot":"","sources":["hero.service.ts"],"names":[],"mappings":";;;;;;;;AACA,sCAA2C;AAG3C,IAAa,WAAW;IAAxB;IAgBA,CAAC;IAfC,+BAAS,GAAT;QACE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED,qCAAe,GAAf;QAAA,iBAKC;QAJC,MAAM,CAAC,IAAI,OAAO,CAAC,UAAA,OAAO;YACxB,8CAA8C;YAC9C,UAAU,CAAC,cAAM,OAAA,OAAO,CAAC,KAAI,CAAC,SAAS,EAAE,CAAC,EAAzB,CAAyB,EAAE,IAAI,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,6BAAO,GAAP,UAAQ,EAAU;QAChB,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE;aACX,IAAI,CAAC,UAAA,MAAM,IAAI,OAAA,MAAM,CAAC,IAAI,CAAC,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,EAAE,KAAK,EAAE,EAAd,CAAc,CAAC,EAAnC,CAAmC,CAAC,CAAC;IAClE,CAAC;IACH,kBAAC;AAAD,CAAC,AAhBD,IAgBC;AAhBY,WAAW;IADvB,iBAAU,EAAE;GACA,WAAW,CAgBvB;AAhBY,kCAAW"}

@ -1,5 +1,4 @@
import { Hero } from './hero'; import { Hero } from './hero';
import { HEROES } from './mock-heroes';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
@Injectable() @Injectable()

@ -1,4 +1,4 @@
export class Hero { export class Hero {
id: number; id: string;
name: string; name: string;
} }

@ -1,7 +1,6 @@
<h2>My Heroes</h2> <h2>My Heroes</h2>
<ul class="heroes"> <ul class="heroes">
<li *ngFor="let hero of heroes" <li *ngFor="let hero of heroes"
[class.selected]="hero === selectedHero"
(click)="onSelect(hero)"> (click)="onSelect(hero)">
<span class="badge">{{hero.id}}</span> {{hero.name}} <span class="badge">{{hero.id}}</span> {{hero.name}}
</li> </li>

@ -10,11 +10,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core"); var core_1 = require("@angular/core");
var router_1 = require("@angular/router");
var hero_service_1 = require("./hero.service");
var HeroesComponent = (function () { var HeroesComponent = (function () {
function HeroesComponent(router, heroService) { function HeroesComponent(heroService) {
this.router = router;
this.heroService = heroService; this.heroService = heroService;
} }
HeroesComponent.prototype.getHeroes = function () { HeroesComponent.prototype.getHeroes = function () {
@ -22,7 +19,6 @@ var HeroesComponent = (function () {
this.heroService.getHeroes().then(function (heroes) { return _this.heroes = heroes; }); this.heroService.getHeroes().then(function (heroes) { return _this.heroes = heroes; });
}; };
HeroesComponent.prototype.ngOnInit = function () { HeroesComponent.prototype.ngOnInit = function () {
this.getHeroes();
}; };
HeroesComponent.prototype.onSelect = function (hero) { HeroesComponent.prototype.onSelect = function (hero) {
this.selectedHero = hero; this.selectedHero = hero;
@ -35,11 +31,9 @@ var HeroesComponent = (function () {
HeroesComponent = __decorate([ HeroesComponent = __decorate([
core_1.Component({ core_1.Component({
selector: 'my-heroes', selector: 'my-heroes',
templateUrl: './heroes.component.html',
styleUrls: ['./heroes.component.css'] styleUrls: ['./heroes.component.css']
}), }),
__metadata("design:paramtypes", [router_1.Router, __metadata("design:paramtypes", [Object])
hero_service_1.HeroService])
], HeroesComponent); ], HeroesComponent);
exports.HeroesComponent = HeroesComponent; exports.HeroesComponent = HeroesComponent;
//# sourceMappingURL=heroes.component.js.map //# sourceMappingURL=heroes.component.js.map

@ -1 +1 @@
{"version":3,"file":"heroes.component.js","sourceRoot":"","sources":["heroes.component.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAAkD;AAClD,0CAAyC;AAGzC,+CAA6C;AAO7C,IAAa,eAAe;IAI1B,yBACU,MAAc,EACd,WAAwB;QADxB,WAAM,GAAN,MAAM,CAAQ;QACd,gBAAW,GAAX,WAAW,CAAa;IAAI,CAAC;IAEvC,mCAAS,GAAT;QAAA,iBAEC;QADC,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,UAAA,MAAM,IAAI,OAAA,KAAI,CAAC,MAAM,GAAG,MAAM,EAApB,CAAoB,CAAC,CAAC;IACpE,CAAC;IAED,kCAAQ,GAAR;QACE,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;IAED,kCAAQ,GAAR,UAAS,IAAU;QACjB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;IAC3B,CAAC;IAED,oCAAU,GAAV;QACE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1D,CAAC;IACH,sBAAC;AAAD,CAAC,AAvBD,IAuBC;AAvBY,eAAe;IAL3B,gBAAS,CAAC;QACT,QAAQ,EAAE,WAAW;QACrB,WAAW,EAAE,yBAAyB;QACtC,SAAS,EAAE,CAAE,wBAAwB,CAAE;KACxC,CAAC;qCAMkB,eAAM;QACD,0BAAW;GANvB,eAAe,CAuB3B;AAvBY,0CAAe"} {"version":3,"file":"heroes.component.js","sourceRoot":"","sources":["heroes.component.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAAkD;AASlD,IAAa,eAAe;IAI1B,yBACU,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAI,CAAC;IAEvC,mCAAS,GAAT;QAAA,iBAEC;QADC,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,UAAA,MAAM,IAAI,OAAA,KAAI,CAAC,MAAM,GAAG,MAAM,EAApB,CAAoB,CAAC,CAAC;IACpE,CAAC;IAED,kCAAQ,GAAR;IACA,CAAC;IAED,kCAAQ,GAAR,UAAS,IAAU;QACjB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;IAC3B,CAAC;IAED,oCAAU,GAAV;QACE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1D,CAAC;IACH,sBAAC;AAAD,CAAC,AArBD,IAqBC;AArBY,eAAe;IAJ3B,gBAAS,CAAC;QACT,QAAQ,EAAE,WAAW;QACrB,SAAS,EAAE,CAAE,wBAAwB,CAAE;KACxC,CAAC;;GACW,eAAe,CAqB3B;AArBY,0CAAe"}

@ -2,11 +2,9 @@ import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Hero } from './hero'; import { Hero } from './hero';
import { HeroService } from './hero.service';
@Component({ @Component({
selector: 'my-heroes', selector: 'my-heroes',
templateUrl: './heroes.component.html',
styleUrls: [ './heroes.component.css' ] styleUrls: [ './heroes.component.css' ]
}) })
export class HeroesComponent implements OnInit { export class HeroesComponent implements OnInit {
@ -14,7 +12,6 @@ export class HeroesComponent implements OnInit {
selectedHero: Hero; selectedHero: Hero;
constructor( constructor(
private router: Router,
private heroService: HeroService) { } private heroService: HeroService) { }
getHeroes(): void { getHeroes(): void {
@ -22,7 +19,6 @@ export class HeroesComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
this.getHeroes();
} }
onSelect(hero: Hero): void { onSelect(hero: Hero): void {

@ -7,7 +7,6 @@ exports.HEROES = [
{ id: 14, name: 'Celeritas' }, { id: 14, name: 'Celeritas' },
{ id: 15, name: 'Magneta' }, { id: 15, name: 'Magneta' },
{ id: 16, name: 'RubberMan' }, { id: 16, name: 'RubberMan' },
{ id: 17, name: 'Dynama' },
{ id: 18, name: 'Dr IQ' }, { id: 18, name: 'Dr IQ' },
{ id: 19, name: 'Magma' }, { id: 19, name: 'Magma' },
{ id: 20, name: 'Tornado' } { id: 20, name: 'Tornado' }

@ -1 +1 @@
{"version":3,"file":"mock-heroes.js","sourceRoot":"","sources":["mock-heroes.ts"],"names":[],"mappings":";;AAEa,QAAA,MAAM,GAAW;IAC5B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;IAC5B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;IACzB,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;IAC5B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;IAC7B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IAC3B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;IAC7B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC1B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;IACzB,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;IACzB,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;CAC5B,CAAC"} {"version":3,"file":"mock-heroes.js","sourceRoot":"","sources":["mock-heroes.ts"],"names":[],"mappings":";;AAAa,QAAA,MAAM,GAAW;IAC5B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;IAC5B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;IACzB,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;IAC5B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;IAC7B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IAC3B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;IAC7B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;IACzB,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;IACzB,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;CAC5B,CAAC"}

@ -1,5 +1,3 @@
import { Hero } from './hero';
export const HEROES: Hero[] = [ export const HEROES: Hero[] = [
{ id: 11, name: 'Mr. Nice' }, { id: 11, name: 'Mr. Nice' },
{ id: 12, name: 'Narco' }, { id: 12, name: 'Narco' },
@ -7,7 +5,6 @@ export const HEROES: Hero[] = [
{ id: 14, name: 'Celeritas' }, { id: 14, name: 'Celeritas' },
{ id: 15, name: 'Magneta' }, { id: 15, name: 'Magneta' },
{ id: 16, name: 'RubberMan' }, { id: 16, name: 'RubberMan' },
{ id: 17, name: 'Dynama' },
{ id: 18, name: 'Dr IQ' }, { id: 18, name: 'Dr IQ' },
{ id: 19, name: 'Magma' }, { id: 19, name: 'Magma' },
{ id: 20, name: 'Tornado' } { id: 20, name: 'Tornado' }

Loading…
Cancel
Save