* @ngdoc provider * @name $qProvider * @this * * @description
()
| 17011 | * @description |
| 17012 | */ |
| 17013 | function $QProvider() { |
| 17014 | var errorOnUnhandledRejections = true; |
| 17015 | this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) { |
| 17016 | return qFactory(function(callback) { |
| 17017 | $rootScope.$evalAsync(callback); |
| 17018 | }, $exceptionHandler, errorOnUnhandledRejections); |
| 17019 | }]; |
| 17020 | |
| 17021 | /** |
| 17022 | * @ngdoc method |
| 17023 | * @name $qProvider#errorOnUnhandledRejections |
| 17024 | * @kind function |
| 17025 | * |
| 17026 | * @description |
| 17027 | * Retrieves or overrides whether to generate an error when a rejected promise is not handled. |
| 17028 | * This feature is enabled by default. |
| 17029 | * |
| 17030 | * @param {boolean=} value Whether to generate an error when a rejected promise is not handled. |
| 17031 | * @returns {boolean|ng.$qProvider} Current value when called without a new value or self for |
| 17032 | * chaining otherwise. |
| 17033 | */ |
| 17034 | this.errorOnUnhandledRejections = function(value) { |
| 17035 | if (isDefined(value)) { |
| 17036 | errorOnUnhandledRejections = value; |
| 17037 | return this; |
| 17038 | } else { |
| 17039 | return errorOnUnhandledRejections; |
| 17040 | } |
| 17041 | }; |
| 17042 | } |
| 17043 | |
| 17044 | /** @this */ |
| 17045 | function $$QProvider() { |