mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
17 lines
406 B
TypeScript
17 lines
406 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { Http, Response } from '@angular/http';
|
|
import { Observable } from 'rxjs';
|
|
|
|
import { Hero } from './hero';
|
|
|
|
@Injectable()
|
|
export class HeroSearchService {
|
|
constructor(private http: Http) { }
|
|
|
|
search(term: string): Observable<Hero[]> {
|
|
return this.http
|
|
.get(`app/heroes/?name=${term}`)
|
|
.map((r: Response) => r.json() as Hero[]);
|
|
}
|
|
}
|