1

我需要通过 http 模块获取 jwt 令牌,然后在标头中使用此令牌发出其他请求。如何在令牌获取请求解决之前延迟应用程序初始化?

4

1 回答 1

1
this.http.get(...)
.map(response => response.json())
.flatMap(response => this.http.get(...).map(response => response.json())
.subscribe(response => this.result = response);

您可以使用如何将从后端渲染的参数传递给 angular2 引导方法来延迟应用程序初始化。

于 2016-11-16T13:11:06.503 回答