1 import {provide, Injectable} from 'angular2/angular2';
2 import {Http} from 'angular2/http';
3 import * as Rx from '@reactivex/rxjs/dist/cjs/Rx';
6 export class SearchService {
8 constructor(public http: Http){
11 search(query: string): Rx.Observable<any[]>{
12 return this.http.get(dhisAPI + "/api/organisationUnits?paging=false&filter=name:like:" + query)
14 .map(res => res.organisationUnits)
15 .filter(orgunits => orgunits);
19 export var SEARCH_PROVIDERS: Array<any> = [
20 provide(SearchService, {useClass: SearchService})