[apiService] created a service for getting the API URL
[u/erikhf/frm.git] / src / components / dhisapi / dhisapiService.ts
1 import {Injectable} from 'angular2/angular2';
2 import {Http} from 'angular2/http';
3
4 @Injectable()
5 export class DhisapiService {
6     private http: Http;
7
8     constructor(http: Http){
9         this.http = http;
10     }
11
12     getApiURL = function(callback){
13         this.http.get('../manifest.webapp')
14             .map(res => res.json())
15             .map(res => res.activities.dhis.href)
16             .subscribe( res => callback(res));
17     }
18 }