不能在jHipster应用程序中使用自定义组件/服务的http请求

时间:2017-03-30 20:39:46

标签: angular jhipster

当我在jHipster生成器的app创建中创建新的组件和服务时,http请求在我的组件/服务中不起作用。

很抱歉,如果我跳过并做错了,但在简单的角度应用程序中,这个(http)工作正常。

我创建了简单的示例并推送到此存储库 https://github.com/SerhiiTsybulskyi/jhiHttpIssue 请参阅此文件:https://github.com/SerhiiTsybulskyi/jhiHttpIssue/blob/master/src/main/webapp/app/test/test.component.ts

出了什么问题?

1 个答案:

答案 0 :(得分:0)

http.get()返回Observable,如果您未订阅,则不会发送请求。请参阅documentation

  onClick() {
    this.http.get('management/health').map((res) => res.json()).subscribe();
  }