* @ngdoc provider * @name $qProvider * @this * * @description
()
| 17879 | * @description |
| 17880 | */ |
| 17881 | function $QProvider() { |
| 17882 | var errorOnUnhandledRejections = true; |
| 17883 | this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) { |
| 17884 | return qFactory(function(callback) { |
| 17885 | $rootScope.$evalAsync(callback); |
| 17886 | }, $exceptionHandler, errorOnUnhandledRejections); |
| 17887 | }]; |
| 17888 | |
| 17889 | /** |
| 17890 | * @ngdoc method |
| 17891 | * @name $qProvider#errorOnUnhandledRejections |
| 17892 | * @kind function |
| 17893 | * |
| 17894 | * @description |
| 17895 | * Retrieves or overrides whether to generate an error when a rejected promise is not handled. |
| 17896 | * This feature is enabled by default. |
| 17897 | * |
| 17898 | * @param {boolean=} value Whether to generate an error when a rejected promise is not handled. |
| 17899 | * @returns {boolean|ng.$qProvider} Current value when called without a new value or self for |
| 17900 | * chaining otherwise. |
| 17901 | */ |
| 17902 | this.errorOnUnhandledRejections = function(value) { |
| 17903 | if (isDefined(value)) { |
| 17904 | errorOnUnhandledRejections = value; |
| 17905 | return this; |
| 17906 | } else { |
| 17907 | return errorOnUnhandledRejections; |
| 17908 | } |
| 17909 | }; |
| 17910 | } |
| 17911 | |
| 17912 | /** @this */ |
| 17913 | function $$QProvider() { |