openaire-library/utils/helper/helper.service.ts

27 lines
769 B
TypeScript
Raw Normal View History

import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/share';
import { OpenaireProperties } from '../../utils/properties/openaireProperties';
@Injectable()
export class HelperService {
constructor(private http: Http ) {}
getHelper (router: string):any {
console.info("get router helpText for : "+router);
let url = OpenaireProperties.getHelperPageUrl() + '?q=' + router;
return this.http.get((OpenaireProperties.isCacheEnabled())? (OpenaireProperties.getCacheUrl()+encodeURIComponent(url)): url)
.map(res => <any> res.json());
}
}