Commit 1a97e0a4 authored by liuzheng712's avatar liuzheng712

update

parent 3cc28373
<h1>{{title}}</h1> <app-nav></app-nav>
<h2>My Heroes</h2> <app-leftbar></app-leftbar>
<ul class="heroes"> <!--<term id="ngdiv" [ngClass]="{'hideleftbar':DataStore.leftbarhide}"></term>-->
<li *ngFor="let hero of heroes" <router-outlet></router-outlet>
[class.selected]="hero === selectedHero" <app-footer></app-footer>
(click)="onSelect(hero)">
<span class="badge">{{hero.id}}</span> {{hero.name}}
</li>
</ul>
<div *ngIf="selectedHero">
<h2>{{selectedHero.name}} details!</h2>
<div><label>id: </label>{{selectedHero.id}}</div>
<div>
<label>name: </label>
<input [(ngModel)]="selectedHero.name" placeholder="name"/>
</div>
</div>
import { Component } from '@angular/core'; /**
* Created by liuzheng on 2017/8/31.
export class Hero { */
id: number; import {Component} from '@angular/core';
name: string; import {AppService} from './app.service';
}
const HEROES: Hero[] = [
{ id: 11, name: 'Mr. Nice' },
{ id: 12, name: 'Narco' },
{ id: 13, name: 'Bombasto' },
{ id: 14, name: 'Celeritas' },
{ id: 15, name: 'Magneta' },
{ id: 16, name: 'RubberMan' },
{ id: 17, name: 'Dynama' },
{ id: 18, name: 'Dr IQ' },
{ id: 19, name: 'Magma' },
{ id: 20, name: 'Tornado' }
];
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
templateUrl: './app.component.html', templateUrl: './app.component.html',
styleUrls: ['./app.component.css'] providers: [AppService],
// directives: [LeftbarComponent, TermComponent]
}) })
export class AppComponent { export class AppComponent {
title = 'Tour of Heroes'; // DataStore = DataStore;
heroes = HEROES;
selectedHero: Hero;
onSelect(hero: Hero): void {
this.selectedHero = hero;
}
} }
...@@ -11,7 +11,7 @@ import { HttpModule } from '@angular/http'; ...@@ -11,7 +11,7 @@ import { HttpModule } from '@angular/http';
import {AppRoutingModule} from './app-routing.module'; import {AppRoutingModule} from './app-routing.module';
import {IndexComponent} from './index.component'; import {AppComponent} from './app.component';
import {WelcomeComponent} from './welcome.component'; import {WelcomeComponent} from './welcome.component';
import {NavComponent} from './nav.component'; import {NavComponent} from './nav.component';
import {FooterComponent} from './footer.component'; import {FooterComponent} from './footer.component';
...@@ -26,7 +26,7 @@ import {PageNotFoundComponent} from './not-found.component'; ...@@ -26,7 +26,7 @@ import {PageNotFoundComponent} from './not-found.component';
HttpModule, HttpModule,
], ],
declarations: [ declarations: [
IndexComponent, AppComponent,
WelcomeComponent, WelcomeComponent,
NavComponent, NavComponent,
LeftbarComponent, LeftbarComponent,
...@@ -35,7 +35,7 @@ import {PageNotFoundComponent} from './not-found.component'; ...@@ -35,7 +35,7 @@ import {PageNotFoundComponent} from './not-found.component';
// HeroListComponent, // HeroListComponent,
// CrisisListComponent, // CrisisListComponent,
], ],
bootstrap: [IndexComponent], bootstrap: [AppComponent],
providers: [ providers: [
{provide: Options, useValue: {store: false, level: LoggerLevel.WARN}}, {provide: Options, useValue: {store: false, level: LoggerLevel.WARN}},
Logger Logger
......
/**
* Created by liuzheng on 2017/8/31.
*/
import {Component} from '@angular/core';
import {AppService} from './app.service';
@Component({
selector: 'app-root',
templateUrl: './index.html',
providers: [AppService],
// directives: [LeftbarComponent, TermComponent]
})
export class IndexComponent {
// DataStore = DataStore;
}
<app-nav></app-nav>
<app-leftbar></app-leftbar>
<!--<term id="ngdiv" [ngClass]="{'hideleftbar':DataStore.leftbarhide}"></term>-->
<router-outlet></router-outlet>
<app-footer></app-footer>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment