O'Reilly logo

AngularJS Services by Jim Lavin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Managing user notifications

Now that we have the messaging layer of our application in place, we can build a couple more layers on it that handle cross-cutting concerns around user notifications.

The first thing we'll build is a simple waitSpinner directive that leverages the messaging service to display and hide an animated GIF indicating that our program is busy doing something:

angular.module('brew-everywhere').directive('waitSpinner', function(messaging, events) { return { restrict: 'E', template: '<div class="row"><img src="images/ajax-loader.gif" alt="loading, please wait" /></div>', link: function(scope, element) { element.hide(); var startRequestHandler = function () { // got the request start notification, show the element element.show(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required