1
0
mirror of https://github.com/Microsoft/sql-server-samples.git synced 2025-12-08 14:58:54 +00:00
Files
sql-server-samples/samples/features/json/angularjs/dotnet-tour-of-heroes/wwwroot/app/hero-search.service.ts
Jovan Popovic 08cce021ee AngularJS Hero app
Working version of Hour of heroes app.
2016-10-29 09:34:49 -07:00

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[]);
}
}