ソースを参照

toh-pt3

master
コミット
3ebe71f53b
6個のファイルの変更56行の追加10行の削除
  1. +3
    -1
      src/app/app.module.ts
  2. +0
    -0
      src/app/hero-detail/hero-detail.component.css
  3. +9
    -0
      src/app/hero-detail/hero-detail.component.html
  4. +25
    -0
      src/app/hero-detail/hero-detail.component.spec.ts
  5. +18
    -0
      src/app/hero-detail/hero-detail.component.ts
  6. +1
    -9
      src/app/heroes/heroes.component.html

+ 3
- 1
src/app/app.module.ts ファイルの表示

@@ -4,11 +4,13 @@ import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { HeroesComponent } from './heroes/heroes.component';
import {FormsModule} from '@angular/forms';
import { HeroDetailComponent } from './hero-detail/hero-detail.component';

@NgModule({
declarations: [
AppComponent,
HeroesComponent
HeroesComponent,
HeroDetailComponent
],
imports: [
BrowserModule,


+ 0
- 0
src/app/hero-detail/hero-detail.component.css ファイルの表示


+ 9
- 0
src/app/hero-detail/hero-detail.component.html ファイルの表示

@@ -0,0 +1,9 @@
<div *ngIf="hero">
<h2>{{hero.name | uppercase}} Details</h2>
<div><span>id: </span>{{hero.id}}</div>
<div>
<label>name:
<input [(ngModel)]="hero.name" placeholder="name"/>
</label>
</div>
</div>

+ 25
- 0
src/app/hero-detail/hero-detail.component.spec.ts ファイルの表示

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { HeroDetailComponent } from './hero-detail.component';

describe('HeroDetailComponent', () => {
let component: HeroDetailComponent;
let fixture: ComponentFixture<HeroDetailComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ HeroDetailComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(HeroDetailComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});

+ 18
- 0
src/app/hero-detail/hero-detail.component.ts ファイルの表示

@@ -0,0 +1,18 @@
import {Component, Input, OnInit} from '@angular/core';
import { Hero } from '../hero';

@Component({
selector: 'app-hero-detail',
templateUrl: './hero-detail.component.html',
styleUrls: ['./hero-detail.component.css']
})
export class HeroDetailComponent implements OnInit {

@Input() hero: Hero;

constructor() { }

ngOnInit() {
}

}

+ 1
- 9
src/app/heroes/heroes.component.html ファイルの表示

@@ -7,12 +7,4 @@
</li>
</ul>

<div *ngIf="selectedHero">
<h2>{{selectedHero.name | uppercase}} Details</h2>
<div><span>id: </span>{{selectedHero.id}}</div>
<div>
<label>name:
<input [(ngModel)]="selectedHero.name" placeholder="name"/>
</label>
</div>
</div>
<app-hero-detail [hero]="selectedHero"></app-hero-detail>

読み込み中…
キャンセル
保存