Check internet connection in web using Angular 4

后端 未结 10 2143
感情败类
感情败类 2020-12-15 19:37

I am using Angular 4 for my application development. I need to check If the network connection is available for its have any Connection issue using Angular for. Is it possib

10条回答
  •  余生分开走
    2020-12-15 20:00

    You do not have to use any library for this, you can handle this by this few lines of code.

    Add this below code into your comman error handler service file file name errors-handlers-services.ts

    if (string.includes(<>)) {
          window.location.reload();
     }
    

    This code block is working for me. maybe this code snippet helps you!!

提交回复
热议问题