简体   繁体   English

Angular 2自动为每个http请求阻止ui

[英]Angular 2 automatically block ui for each http request

I am using angular 2. I need to block UI on every HTTP request (get, post, ...) but I need it done automatically not manually by calling start before HTTP request begin and stop at the end. 我正在使用angular2。我需要在每个HTTP请求(获取,发布,...)上阻止UI,但是我需要通过手动操作来自动完成此操作,而无需在HTTP请求开始之前和结束时调用start来手动完成。

For angular 1.x there is plugin that does it. 对于angular 1.x,有可以做到的插件

can anyone guide me? 谁能指导我?

Yes by implementing a canDeactivate guard in your component. 是的,方法是在组件中实现canDeactivate防护。 Follow the documentation, they explain the way to achieve this 遵循文档,他们解释了实现此目标的方法

Hope it's help. 希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM