Project

General

Profile

« Previous | Next » 

Revision 51561

added inline validation messages to create-update repository forms

View differences:

help-content.service.ts
2 2
 * Created by stefania on 7/17/17.
3 3
 */
4 4
import { Injectable } from '@angular/core';
5
import { Http, Response } from '@angular/http';
5
import {Headers, Http, RequestOptions, Response} from '@angular/http';
6 6
import { Observable } from 'rxjs/Rx';
7 7
import { Content, PageContent } from "../domain/page-content";
8 8
import {helpServiceUrl} from "../domain/tempAPI";
9 9

  
10

  
11 10
@Injectable()
12 11
export class HelpContentService {
13 12

  
......
17 16
  constructor (private http: Http) {
18 17
  }
19 18

  
20
  cache : any = {};
19
  getActivePageContent(route: string) {
20
    const url = this._helpServiceUrl + "/page/route?q=" + route;
21
    console.log(`sending request at: ${url}`);
21 22

  
22
  getActivePageContent(route: string) : Observable<PageContent> {
23
    if (!this.cache[route]) {
24
      this.cache[route] = this.http.get(this._helpServiceUrl + "/page/route?q=" + route)
25
        .map(res => <PageContent> res.json())
26
        .catch(this.handleError)
27
        .share();
28
    }
29
    return this.cache[route];
23
    return this.http.get(url)
24
        .map(res => res.json() )
25
        .catch(this.handleError);
30 26
  }
31 27

  
32 28
  private extractData(res: Response) {

Also available in: Unified diff