src/port/refs/fei.ref.ts
Generic FEI Device that queries (Http) against the port to fetch its extended information. This is simply a base class for the other FEI types.
Properties |
Methods |
|
constructor(url: string)
|
||||||||
Defined in src/port/refs/fei.ref.ts:13
|
||||||||
Constructor
Parameters :
|
Protected query$ | ||||||||
query$(param?: string)
|
||||||||
Defined in src/port/refs/fei.ref.ts:29
|
||||||||
Queries the FEI port for the named parameter.
Parameters :
Returns :
Observable<any>
|
Public http |
http:
|
Type : Http
|
Defined in src/port/refs/fei.ref.ts:13
|
The HTTP service being used with this port reference |
Public url |
url:
|
Type : string
|
Defined in src/port/refs/fei.ref.ts:19
|
The URL of the port. |
import { ReflectiveInjector } from '@angular/core';
import { Http } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import { PortRef } from './port.ref';
/**
* Generic FEI Device that queries (Http) against the port to fetch its
* extended information. This is simply a base class for the other FEI types.
*/
export class FeiRef extends PortRef {
/** The HTTP service being used with this port reference */
public http: Http;
/**
* Constructor
* @param url The URL of the port.
*/
constructor (public url: string) {
super(url);
let providers = ReflectiveInjector.resolve([Http]);
let injector = ReflectiveInjector.fromResolvedProviders(providers);
this.http = injector.get(Http);
}
/**
* Queries the FEI port for the named parameter.
*/
protected query$(param?: string): Observable<any> {
let target: string = this.url;
if (param) {
target = target + '/' + param;
}
return this.http
.get(target)
.map(response => response.json());
}
}