本文整理汇总了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");
}