티스토리 뷰
1일 1포스팅이 목표였는데 어제는 회식으로 인해 포스팅하지 못했네요. 못한 포스팅은 주말동안 따라 잡아야겠어요.
import { Injectable } from '@angular/core';
@Injectable()
export class HeroService {
}
import {Component, OnInit} from '@angular/core';
import {Hero} from "./hero";
import {HeroDetailComponent} from "./hero-detail.component";
import {HeroService} from "./hero.service";
@Component({
selector: 'my-app',
templateUrl: 'app/app.component.html',
styleUrls: ['app/app.component.css'],
directives: [HeroDetailComponent],
providers: [HeroService]
})
export class AppComponent implements OnInit {
constructor(private heroService: HeroService) { }
ngOnInit() {
this.getHeroes();
}
title = 'Tour of Heroes';
heroes: Hero[];
selectedHero: Hero;
onSelect(hero: Hero) { this.selectedHero = hero; }
getHeroes() {
this.heroes = this.heroService.getHeroes();
}
}
import { Injectable } from '@angular/core';
import { HEROES } from './mock-heroes';
@Injectable()
export class HeroService {
getHeroes() {
return Promise.resolve(HEROES);
}
}
import {Component, OnInit} from '@angular/core';
import {Hero} from "./hero";
import {HeroDetailComponent} from "./hero-detail.component";
import {HeroService} from "./hero.service";
@Component({
selector: 'my-app',
templateUrl: 'app/app.component.html',
styleUrls: ['app/app.component.css'],
directives: [HeroDetailComponent],
providers: [HeroService]
})
export class AppComponent implements OnInit {
constructor(private heroService: HeroService) { }
ngOnInit() {
this.getHeroes();
}
title = 'Tour of Heroes';
heroes: Hero[];
selectedHero: Hero;
onSelect(hero: Hero) { this.selectedHero = hero; }
getHeroes() {
this.heroService.getHeroes().then(heroes => this.heroes = heroes);
}
}
'Javascript > Angular' 카테고리의 다른 글
5-2. Routing 기초 - 2 (0) | 2016.06.20 |
---|---|
5-1. Routing 기초 - 1 (0) | 2016.06.19 |
3. 파일 나누기, Component 나누기 (1) | 2016.06.15 |
2. 기본적인 Directive 맛보기 (1) | 2016.06.13 |
1. Data Binding 맛보기 (0) | 2016.06.09 |
- Total
- Today
- Yesterday
- TypeScript
- Spring Boot
- 유아동겸용
- angular 2
- routeParams
- Ajax
- RouteConfig
- 거품정렬
- CURL
- angular2
- angular
- 알고리즘
- routing
- 기내반입유모차
- 빠른 정렬
- rest login
- mockmvc
- styleUrls
- spring security
- insert sort
- templateUrl
- mybatis
- routerLink
- test static import
- 타보유모차
- router-outlet
- 머지소트
- 어드보케이트
- controller test
- 티지유모차
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |