rommsen / plesynd

HTML5 Personal Learning Environment with Offline Capabilities
MIT License
8 stars 1 forks source link

Reagieren auf Browser online/offline Events im Widget #30

Closed rommsen closed 12 years ago

rommsen commented 12 years ago

siehe: https://groups.google.com/forum/?fromgroups#!topic/angular/ZncvSVUc9y4 und http://jsfiddle.net/rommsen/QY8w2/

rommsen commented 12 years ago

implemented via

.run(function ($rootScope, $window) {
        $window.addEventListener("online", function () {
            $rootScope.$broadcast('onlineChanged', true);
        }, true);

        $window.addEventListener("offline", function () {
            $rootScope.$broadcast('onlineChanged', false);
        }, true);
    });

and

$scope.$on('onlineChanged', function (evt, isOnline) {