My Angular app is designed for Playstation 3 & 4, and needs to display an 
error page whenever the net connection drops.

I've developed a factory containing all the Playstation-specific code that 
receives events from the device and uses $rootScope.$broadcast to 
communicate them to the rest of the app.

I bind an event handler in my app.run that attempts to launch the error 
route using $location.path whenever it receives such an event. I cache all 
my routes so that they should be available even if the app later has no net 
connection to fetch them.

The problem is that although the route is cached, it takes a very long time 
(up to 90 seconds) between the call to $location.path and the view actually 
opening. The fact that it does open at all shows that it is definitely 
cached. Note that if I reconnect the Playstation, the error route displays 
as soon as it reconnects.

So, my question is - what is $location.path doing that could explain this 
long delay and is there anything I can do to prevent it?

I'm using Angular 1.3 Beta 10 and the Playstation browser is webkit-based.

These errors are handled like so

app.run ( ['$location', '$templateCache', '$http', '$rootScope',

    function ( $location, $templateCache, $http, $rootScope ) {

    // cache the error partial so that it can be loaded without a net connection
    $http.get ( 'partials/globalError.html', { cache: $templateCache } );

    // monitor for error messages from the Playstation factory
    $rootScope.$on ( 'error', function ( e, errorMessage ) {
        $rootScope.globalErrorMessage = errorMessage;
        $rootScope.$apply ( function ( ) {
            $location.path ( '/globalError' );
        });
    });         }]);  

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to