diff options
Diffstat (limited to 'src/ng/q.js')
| -rw-r--r-- | src/ng/q.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/ng/q.js b/src/ng/q.js index 38a63f53..09448fd4 100644 --- a/src/ng/q.js +++ b/src/ng/q.js @@ -15,7 +15,7 @@ * From the perspective of dealing with error handling, deferred and promise APIs are to * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming. * - * <pre> + * ```js * // for the purpose of this example let's assume that variables `$q`, `scope` and `okToGreet` * // are available in the current lexical scope (they could have been injected or passed in). * @@ -47,7 +47,7 @@ * }, function(update) { * alert('Got notification: ' + update); * }); - * </pre> + * ``` * * At first it might not be obvious why this extra complexity is worth the trouble. The payoff * comes in the way of guarantees that promise and deferred APIs make, see @@ -119,14 +119,14 @@ * Because calling the `then` method of a promise returns a new derived promise, it is easily * possible to create a chain of promises: * - * <pre> + * ```js * promiseB = promiseA.then(function(result) { * return result + 1; * }); * * // promiseB will be resolved immediately after promiseA is resolved and its value * // will be the result of promiseA incremented by 1 - * </pre> + * ``` * * It is possible to create chains of any length and since a promise can be resolved with another * promise (which will defer its resolution further), it is possible to pause/defer resolution of @@ -146,7 +146,7 @@ * * # Testing * - * <pre> + * ```js * it('should simulate promise', inject(function($q, $rootScope) { * var deferred = $q.defer(); * var promise = deferred.promise; @@ -166,7 +166,7 @@ * $rootScope.$apply(); * expect(resolvedValue).toEqual(123); * })); - * </pre> + * ``` */ function $QProvider() { @@ -357,7 +357,7 @@ function qFactory(nextTick, exceptionHandler) { * current promise, you have to "rethrow" the error by returning a rejection constructed via * `reject`. * - * <pre> + * ```js * promiseB = promiseA.then(function(result) { * // success: do something and resolve promiseB * // with the old or a new result @@ -372,7 +372,7 @@ function qFactory(nextTick, exceptionHandler) { * } * return $q.reject(reason); * }); - * </pre> + * ``` * * @param {*} reason Constant, message, exception or an object representing the rejection reason. * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`. |
