1
我需要通过http模块获取jwt令牌,然后在头中使用此令牌发出其他请求。我如何延迟应用程序初始化,直到令牌获取请求解决?在发送其他http请求之前发送http请求angular 2
我需要通过http模块获取jwt令牌,然后在头中使用此令牌发出其他请求。我如何延迟应用程序初始化,直到令牌获取请求解决?在发送其他http请求之前发送http请求angular 2
this.http.get(...)
.map(response => response.json())
.flatMap(response => this.http.get(...).map(response => response.json())
.subscribe(response => this.result = response);
您可以使用How to pass parameters rendered from backend to angular2 bootstrap method延迟应用程序初始化。