* @ngdoc provider * @name $qProvider * @this * * @description
()
| 17240 | * @description |
| 17241 | */ |
| 17242 | function $QProvider() { |
| 17243 | var errorOnUnhandledRejections = true; |
| 17244 | this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) { |
| 17245 | return qFactory(function(callback) { |
| 17246 | $rootScope.$evalAsync(callback); |
| 17247 | }, $exceptionHandler, errorOnUnhandledRejections); |
| 17248 | }]; |
| 17249 | |
| 17250 | /** |
| 17251 | * @ngdoc method |
| 17252 | * @name $qProvider#errorOnUnhandledRejections |
| 17253 | * @kind function |
| 17254 | * |
| 17255 | * @description |
| 17256 | * Retrieves or overrides whether to generate an error when a rejected promise is not handled. |
| 17257 | * This feature is enabled by default. |
| 17258 | * |
| 17259 | * @param {boolean=} value Whether to generate an error when a rejected promise is not handled. |
| 17260 | * @returns {boolean|ng.$qProvider} Current value when called without a new value or self for |
| 17261 | * chaining otherwise. |
| 17262 | */ |
| 17263 | this.errorOnUnhandledRejections = function(value) { |
| 17264 | if (isDefined(value)) { |
| 17265 | errorOnUnhandledRejections = value; |
| 17266 | return this; |
| 17267 | } else { |
| 17268 | return errorOnUnhandledRejections; |
| 17269 | } |
| 17270 | }; |
| 17271 | } |
| 17272 | |
| 17273 | /** @this */ |
| 17274 | function $$QProvider() { |