diff --git a/js/angular/service/backdrop.js b/js/angular/service/backdrop.js index 4b89bddbc8c..f5aa531dc58 100644 --- a/js/angular/service/backdrop.js +++ b/js/angular/service/backdrop.js @@ -18,10 +18,14 @@ * For example, if `retain` is called three times, the backdrop will be shown until `release` * is called three times. * + * **Notes:** + * - The backdrop service will broadcast 'backdrop.shown' and 'backdrop.hidden' events from the root scope, + * this is useful for alerting native components not in html. + * * @usage * * ```js - * function MyController($scope, $ionicBackdrop, $timeout) { + * function MyController($scope, $ionicBackdrop, $timeout, $rootScope) { * //Show a backdrop for one second * $scope.action = function() { * $ionicBackdrop.retain(); @@ -29,13 +33,24 @@ * $ionicBackdrop.release(); * }, 1000); * }; + * + * // Execute action on backdrop disappearing + * $scope.$on('backdrop.hidden', function() { + * // Execute action + * }); + * + * // Execute action on backdrop appearing + * $scope.$on('backdrop.shown', function() { + * // Execute action + * }); + * * } * ``` */ IonicModule .factory('$ionicBackdrop', [ - '$document', '$timeout', '$$rAF', -function($document, $timeout, $$rAF) { + '$document', '$timeout', '$$rAF', '$rootScope', +function($document, $timeout, $$rAF, $rootScope) { var el = jqLite('