Does Angular support/wrap window.navigator.onLine?
Does Angular support/wrap window.navigator.onLine and it's supporting events window.addEventListener("offline", function(e) {alert("offline");}) etc?
I am needing to use this as a part of my SPA/Offline mode support.
Thanks!
1 comments · 100% upvoted · other discussions
Angular does have a $window module that wraps window which you can inject into services, controllers and directives. It has the same functionality, so you should be able to just use $window.navigator.onLine. You can listen for this globally by using the global app module's .run() method as demonstrated in this Stack Overflow article.