本文整理匯總了TypeScript中@angular/common/http.HttpClient.get方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript HttpClient.get方法的具體用法?TypeScript HttpClient.get怎麽用?TypeScript HttpClient.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@angular/common/http.HttpClient
的用法示例。
在下文中一共展示了HttpClient.get方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getEmployees
/*
* EMPLEADOS
*/
getEmployees() {
return this.http.get(this.api + 'employees', { observe: 'response' });
}
示例2: fetchNavigationInfo
/**
* Get an observable that fetches the `NavigationResponse` from the server.
* We create an observable by calling `http.get` but then publish it to share the result
* among multiple subscribers, without triggering new requests.
* We use `publishLast` because once the http request is complete the request observable completes.
* If you use `publish` here then the completed request observable will cause the subscribed observables to complete too.
* We `connect` to the published observable to trigger the request immediately.
* We could use `.refCount` here but then if the subscribers went from 1 -> 0 -> 1 then you would get
* another request to the server.
* We are not storing the subscription from connecting as we do not expect this service to be destroyed.
*/
private fetchNavigationInfo(): Observable<NavigationResponse> {
const navigationInfo = this.http.get<NavigationResponse>(navigationPath)
.pipe(publishLast());
(navigationInfo as ConnectableObservable<NavigationResponse>).connect();
return navigationInfo;
}
示例3: getScript
getScript(scriptId: number) {
return this.http.get<Script>(`${InteractiveExplorerConfig.API_URL}/scripts/${scriptId}`);
}
示例4: checkUser
checkUser(): Observable<UserInfo> {
return this.http.get<UserInfoResponse>('/raw/auth/check?format=json').pipe(
map(resp => AuthService.statusCheck(resp)));
}
示例5: getMyLikes
public getMyLikes (): Observable<IPagedResult<ITrack>> {
const url = `${this._audioZoneService.getCurrentZoneSnapshot().path}/api/likes/mylikes?start=0&take=50`;
return this._http.get<IPagedResult<ITrack>>(url);
}
示例6: getMobilePlanById
getMobilePlanById(id: number): Observable<MobilePlan> {
return this.service.get<MobilePlan>('http://localhost:3000/mobilePlans/' + id);
}
示例7: findAll
findAll(page: number, count: number) {
return this.http.get(`${LUF_API}/escalas/${page}/${count}`);
}
示例8: runReportTests
runReportTests():Observable<any>{
// return this.http.get("http://localhost:3000/Project2/Servlet/ProtractorTests"); // local
return this.http.get("http://54.174.104.191:8080/Project2/Servlet/ReportTests");
}
示例9: runManageBatch
runManageBatch():Observable<any>{
return this.http.get("http://54.174.104.191:8080/Project2/Servlet/ManageBatch");
}
示例10: getSomething
getSomething():Observable<any>{
return this.http.get("http://54.174.104.191:8080/Project2/Servlet/getSomething");
}