projects
/
examples
/
angular-tour-of-heroes
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
4: Add Services
[examples/angular-tour-of-heroes]
/
src
/
app
/
hero.service.ts
diff --git
a/src/app/hero.service.ts
b/src/app/hero.service.ts
index
7e0771a
..
d0801f3
100644
(file)
--- a/
src/app/hero.service.ts
+++ b/
src/app/hero.service.ts
@@
-1,6
+1,8
@@
import { Injectable } from '@angular/core';
import { Injectable } from '@angular/core';
+import { Observable, of } from 'rxjs';
import { Hero } from './hero';
import { HEROES } from './mock-heroes';
import { Hero } from './hero';
import { HEROES } from './mock-heroes';
+import { MessageService } from './message.service';
@Injectable({
@Injectable({
@@
-8,9
+10,9
@@
import { HEROES } from './mock-heroes';
})
export class HeroService {
})
export class HeroService {
- constructor() { }
+ constructor(
private messageService : MessageService
) { }
- getHeroes() :
Hero[]
{
- return
HEROES
;
+ getHeroes() :
Observable<Hero[]>
{
+ return
of(HEROES)
;
}
}
}
}